Value based implementation of nhibernate class

I am creating a blog library using nHibernate and I have a BlogEntry class that has a CreateBy property of type User (User is an abstract class). Two concrete implementations of the User class: RegisteredUser and UnknownUser . I would like to create an instance of nHibernate UnknownUser , if the value in the "Created" is null. If it is not null, I would like to create an instance of RegisteredUser .

Is this possible with nHibernate? and what should the mapping file look like, if any?

+1


source to share


1 answer


I actually figured it out. I watched a video here about modeling inheritance in nHibernate. I needed to create subclass nodes in my user mapping file and create a discriminator column in the table.



+1


source







All Articles