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!

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top