Ok, now I feel stupid!

It’s "not null” as opposed to "not-null” when I'm using a
discriminator value.

Exporting the xml helped me a lot, I should have done that first off.
And yes, it did work with specifying a string as the type, even if it
is a numeric data type, so that's great!  I'll keep an eye out for
future updates where that will not be necessary, so that it doesn’t
confuse the team.

Thanks again!
-Jason

On May 3, 10:08 am, James Gregory <[email protected]> wrote:
> Well, FNH just generates XML under the hood so there shouldn't be a
> distinction between a keyword and the string literal.
> There's a way to export the xml that FNH is passing to NH, it might be worth
> having a look at that and comparing it to what you'd expect.
>
> If you're using the Fluently.Configure style configuration, there's an
> ExportTo method on the FluentMappings property
> (m.FluentMappings.AddFromAssemblyOf<X>().ExportTo("Path")). If you're using
> the PersistenceModel directly there's a WriteMappingsTo call you can use.
>
> On Sun, May 3, 2009 at 4:03 PM, jcavaliere <[email protected]>wrote:
>
>
>
>
>
> > Version 2.1
>
> > I did try changing the type to a string, but is seemed to be looking
> > for the literal of "null" and "not-null” rather than the keyword
> > interpretation that the xml supports.
>
> > Take your time and to it right - and if it takes a couple weeks I'm
> > all happy.  I see fluent NHibernate as the long term solution and, if
> > I have to, I'll put an extra column in the tables as an interim
> > solution until it's implemented.
>
> > Best regards,
> > -Jason
>
> > On May 3, 9:55 am, James Gregory <[email protected]> wrote:
> > > 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 -- Hide quoted text -
>
> > > - Show quoted text -- 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