Can't you change then type in the Discriminate call to be string?
I'm actually in the middle of some changes to this area (not yet committed),
one of which is to remove the strictness of the types for the discriminator.
Interestingly, I was not aware of the null/not-null behavior, and it seems
to be very poorly documented. What version of NH are you using?

On Sun, May 3, 2009 at 3:49 PM, jcavaliere <[email protected]>wrote:

>
> Great - I'll make that change.  It still doesn’t compile though,
> because I'm testing the value of an int property on my domain with a
> string value.  Does this all lead to disappointment for me in the
> short term?
>
> Thanks again for the super quick response – I’m really happy w/ the
> framework overall!
> -Jason
>
> On May 3, 9:36 am, James Gregory <[email protected]> wrote:
> > 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:- Hide quoted text -
> >
> > - Show quoted text -
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to