Question

I have an interface and a class which implements this interface.

public interface IPhase {
    string Description { get; set; }
    int Id { get; }
    string Phase { get; set; }
}

public class Phase : IPhase {
    // Implementation here...
}

Now, using NHibernate 2.1.2.GA, I wish to use a table-per-class-hierarchy to map the interface and its implementor, and indeed, I don't need a discriminator, as this implementor will be the only class persisted in this table. I haven't used NHibernate for about a year and a half now, and I'm suffering some memory blanks here...

I have read this question and answers which is related, except I'm not using FNH.
NHibernate Mapping: Save hierarchy to single table without discriminator

  1. I wonder whether the discriminator attribute is obligatory while using subclass?

  2. What shall my XML mapping look like in this particular context?

Thanks kindly for your help!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top