Thanks!

I will give that a try! I did not know I had to register subclasses if
the base class is using the Table in the database.

Thanks,
Azam

On Aug 12, 9:47 am, Hudson Akridge <hudson.akri...@gmail.com> wrote:
> Even with no specific attributes on Teacher (which if all you've got is
> different behavior, you may want to look at the State pattern), you still
> need to register Teacher as a subclass with FNH/NH, and you do that by
> declaring it on the DiscriminateSubclasses FNH method in your UserMap.
>
>
>
>
>
> On Wed, Aug 12, 2009 at 9:45 AM, AzamSharp <azamsh...@gmail.com> wrote:
>
> > Hi,
>
> > Thanks for the reply!
>
> > Teacher inherits from User class and there is only Users table in the
> > database.
>
> > User class has a UserMap which defines the mapping for the User.
> > Teacher does not define any mapping. If I don't have any mapping for
> > Teacher then it gives error for "persister not defined".
>
> > Thanks,
> > Azam
>
> > On Aug 12, 9:38 am, James Gregory <jagregory....@gmail.com> wrote:
> > > I was actually referring to what Azam is trying to do :)
>
> > > You should never need to subclass your ClassMap.
>
> > > On Wed, Aug 12, 2009 at 3:30 PM, Hudson Akridge <
> > hudson.akri...@gmail.com>wrote:
>
> > > > Absolutely correct :) I might have misunderstood what the OP was
> > asking, I
> > > > assumed that he wanted to extend the mappings for Teacher from his
> > UserMap.
> > > > As James says, Teacher automatically gets the mappings from it's base
> > class
> > > > of User, but if you want to map the Teacher specific attributes, you
> > need to
> > > > map those in the UserMap via the DiscriminateOnSubclasses Fluent
> > mapping.
>
> > > > On Wed, Aug 12, 2009 at 9:26 AM, James Gregory <
> > jagregory....@gmail.com>wrote:
>
> > > >> Why would you want to do that? Subclasses automatically inherit their
> > > >> parents mappings, so if there's nothing new in a subclass there's
> > nothing to
> > > >> map. There's no benefit in subclassing your parent's ClassMap.
>
> > > >> On Wed, Aug 12, 2009 at 3:15 PM, Hudson Akridge <
> > hudson.akri...@gmail.com
> > > >> > wrote:
>
> > > >>> You have to map inheritance with the Discriminate mapping in your
> > User
> > > >>> class. So all of your mapping for any concretes of User
> > (Teacher/Student)
> > > >>> will have to be in the UserMap. In release 1.0 (The model branch on
> > Github
> > > >>> atm), that's not the case, and you can actually create separate class
> > maps
> > > >>> for each of the sub-classes. Check it out if you're bored, any
> > additional
> > > >>> feedback will assist James with getting a 1.0 release out faster :)
>
> > > >>> On Wed, Aug 12, 2009 at 8:46 AM, AzamSharp <azamsh...@gmail.com>
> > wrote:
>
> > > >>>> Can I use inheritance when using Mapping?
>
> > > >>>> Let's say I have a User class and the UserMap defined. I have
> > Teacher
> > > >>>> class which inherit from User and uses the same table as User (Users
> > > >>>> table). Now, I want to use the same mapping for the Teacher class.
> > Can
> > > >>>> I say:
>
> > > >>>> public class TeacherMap : UserMap
> > > >>>> {
> > > >>>> }
>
> > > >>>> For some reason that above does not seems to work as expected.
>
> > > >>> --
> > > >>> - Hudson
> > > >>>http://www.bestguesstheory.com
> > > >>>http://twitter.com/HudsonAkridge
>
> > > > --
> > > > - Hudson
> > > >http://www.bestguesstheory.com
> > > >http://twitter.com/HudsonAkridge
>
> --
> - Hudsonhttp://www.bestguesstheory.comhttp://twitter.com/HudsonAkridge
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to