You should be chaining your subclass calls, like so:
DiscriminateSubClassesOnColumn<int>("CustomerID")
.SubClass<NewSalesPerson>("null", m => { })
.SubClass<SalesPerson>("not-null", m => { });
On Sun, May 3, 2009 at 2:49 PM, jcavaliere <[email protected]>wrote:
>
> Maybe I'm not following you - so I have an interface mapped to my db,
> ISalesPerson, and I want to elevate privileges based on whether they
> have made a sale or not, based on an ID those points to the customer
> table.
>
> So if CustomerID is null I map to a NewSalesPerson Class, if it is not
> null, I map to SalesPerson subclass. Her'es the map I have so far.
> This works w/ the XML files, but I can't figure out how to make it
> work with the fluent format. I'm sad too, because I really like the
> testability that goes with this setup.
>
> Thanks for the help!
> -Jason
>
>
>
> public class SalesPersonMap : ClassMap<ISalesPerson>
> {
> public SalesPersonMap()
> {
> Id(x => x.SalesPersonID);
> Map(x => x.CustomerID);
> Map(x => x.Address);
> Map(x => x.City);
> Map(x => x.Country);
> Map(x => x.Email);
> Map(x => x.Fax);
> Map(x => x.IsActive);
> Map(x => x.Phone);
> Map(x => x.State);
> Map(x => x.Zip);
> Map(x => x.IsVisible);
> WithTable("SalesPerson");
>
> DiscriminateSubClassesOnColumn<int>("CustomerID
> ").SubClass<NewSalesPerson>("null", m => { });
> DiscriminateSubClassesOnColumn<int>("CustomerID
> ").SubClass<SalesPerson>("not-null", m => { });
>
> }
>
> }
>
>
>
>
> On May 3, 5:44 am, James Gregory <[email protected]> wrote:
> > There's an overload on the SubClass method that takes a discriminator
> value,
> > otherwise it defaults to the class name.
> >
> > On Sat, May 2, 2009 at 5:40 PM, jcavaliere <[email protected]
> >wrote:
> >
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---