You don't need to. When working with fluent mappings as opposed to automappings, only the classes that you specifically write class maps for are mapped. The include/ignore methods are there to give the automapper guidance and simply have no meaning when working with fluently mapped classes.
2010/1/17 clayton collie <[email protected]> > Paul, > can we do this for non-Automapped classes ? > > > On Sat, Jan 16, 2010 at 2:14 PM, Mark Nijhof <[email protected]>wrote: > >> Cool Paul, >> >> That was it, At least FNH is able to map everything again, now adding >> a proper test arround the problem area to verify all is ok :) >> >> -Mark >> >> >> On Sat, Jan 16, 2010 at 1:56 PM, Paul Batum <[email protected]> wrote: >> > I'm just going to take a stab... it looks like the problem is that you >> need >> > to tell FNH that you want the Debt class mapped even though it is >> abstract. >> > You do this by using IncludeBase<Debt>() in the same place as your >> > IgnoreBase calls (and make sure you don't call IgnoreBase<Debt>(), of >> > course). >> > >> > On Sat, Jan 16, 2010 at 5:57 AM, Mark Nijhof <[email protected]> >> wrote: >> >> >> >> Hmm I changed this: >> >> >> >> s.IsDiscriminated = type => type == typeof (BoatLoan); >> >> s.IsDiscriminated = type => type == typeof (CarLoan); >> >> s.IsDiscriminated = type => type == typeof (CreditCard); >> >> s.IsDiscriminated = type => type == typeof (Mortgage); >> >> s.IsDiscriminated = type => type == typeof >> (UnsecuredLoan); >> >> >> >> To be one statement, but that didn't work either >> >> >> >> -Mark >> >> >> >> >> >> On Fri, Jan 15, 2010 at 7:53 PM, Mark Nijhof <[email protected]> >> >> wrote: >> >> > I can't get either one of these to work: >> >> > >> >> > public class DebtSubclassConvention : ISubclassConvention//, >> >> > ISubclassConventionAcceptance >> >> > { >> >> > public void Apply(ISubclassInstance instance) >> >> > { >> >> > if (instance.EntityType.BaseType == typeof(Debt)) >> >> > instance.DiscriminatorValue(instance.EntityType.Name >> ); >> >> > } >> >> > >> >> > public void Accept(IAcceptanceCriteria<ISubclassInspector> >> >> > criteria) >> >> > { >> >> > criteria.Expect(subclass => >> >> > Type.GetType(subclass.Name).BaseType == typeof(Debt)); >> >> > } >> >> > } >> >> > public class DebtJoinedSubclassConvention : >> >> > IJoinedSubclassConvention//, IJoinedSubclassConventionAcceptance >> >> > { >> >> > public void Apply(IJoinedSubclassInstance instance) >> >> > { >> >> > //if (instance.EntityType.BaseType == typeof(Debt)) >> >> > // instance.DiscriminatorValue( >> instance.EntityType.Name); >> >> > } >> >> > >> >> > public void >> >> > Accept(IAcceptanceCriteria<IJoinedSubclassInspector> criteria) >> >> > { >> >> > criteria.Expect(subclass => >> >> > Type.GetType(subclass.Name).BaseType == typeof(Debt)); >> >> > } >> >> > } >> >> > >> >> > I placed break points in them and they don't seem to be called. >> >> > >> >> > I also tried: >> >> > >> >> > public class DebtOverride : IAutoMappingOverride<Debt> >> >> > { >> >> > public void Override(AutoMapping<Debt> mapping) >> >> > { >> >> > mapping.SubClass<BoatLoan>("BoatLoan"); >> >> > mapping.SubClass<CarLoan>("CarLoan"); >> >> > mapping.SubClass<CreditCard>("CreditCard"); >> >> > mapping.SubClass<Mortgage>("Mortgage"); >> >> > mapping.SubClass<UnsecuredLoan>("UnsecuredLoan"); >> >> > } >> >> > } >> >> > >> >> > Which also doesn't get called, so I am pretty sure there is something >> >> > wrong with my setup :) >> >> > >> >> > public EntityPersistenceModel() >> >> > { >> >> > AddEntityAssembly(typeof(DomainEntity).Assembly); >> >> > >> >> > Alterations(x => x.Add<AutoMapAlteration>()); >> >> > >> >> > Setup(s => >> >> > { >> >> > s.FindIdentity = prop => prop.Name == "Id" && >> >> > prop.PropertyType == typeof(Guid); >> >> > s.IsComponentType = type => type.BaseType == >> >> > typeof(ComponentBaseForNHibernate); >> >> > s.IsDiscriminated = type => type == typeof (BoatLoan); >> >> > s.IsDiscriminated = type => type == typeof (CarLoan); >> >> > s.IsDiscriminated = type => type == typeof >> (CreditCard); >> >> > s.IsDiscriminated = type => type == typeof (Mortgage); >> >> > s.IsDiscriminated = type => type == typeof >> >> > (UnsecuredLoan); >> >> > }); >> >> > >> >> > IgnoreBase<DomainEntity>(); >> >> > //IgnoreBase<Debt>(); >> >> > IgnoreBase<SharedOwnershipIdentifierBase>(); >> >> > IgnoreBase(typeof(SharedOwnershipIdentifierBaseLogic<>)); >> >> > >> >> > Conventions.Setup(f => >> >> > f.AddFromAssemblyOf<IdentityColumnConvention>()); >> >> > >> >> > UseOverridesFromAssemblyOf<IdentityColumnConvention>(); >> >> > } >> >> > >> >> > I also tried to ignore the base but it all doesn't matter what I try >> :( >> >> > >> >> > -Mark >> >> > >> >> > On Fri, Jan 15, 2010 at 6:38 PM, Mark Nijhof <[email protected]> >> >> > wrote: >> >> >> James, >> >> >> >> >> >> Should I use a MapClass to manually add the sub classes? Or should I >> >> >> use an override convention on the BaseClass? >> >> >> >> >> >> -Mark >> >> >> >> >> >> On Fri, Jan 15, 2010 at 1:12 AM, Mark Nijhof <[email protected] >> > >> >> >> wrote: >> >> >>> Hi James, >> >> >>> >> >> >>> Thanks for the suggestion, I'll give #1 a good try tomorrow. By >> doing >> >> >>> so is it still possible to have these in different tables vs using >> a >> >> >>> discriminator? >> >> >>> >> >> >>> -Mark >> >> >>> >> >> >>> >> >> >>> On Thu, Jan 14, 2010 at 4:32 PM, James Gregory >> >> >>> <[email protected]> wrote: >> >> >>>> I've not had a great deal of experience with what I'm about to >> >> >>>> suggest, but >> >> >>>> I know at least Hudson has dealt with it in the past so he might >> >> >>>> weigh in >> >> >>>> later. >> >> >>>> Your entities aren't actually related as far as NHibernate is >> >> >>>> concerned. >> >> >>>> They're not being mapped as subclasses of anything, so NH doesn't >> >> >>>> know how >> >> >>>> to pull them all together in one query. There are really two ways >> to >> >> >>>> handle >> >> >>>> this: >> >> >>>> >> >> >>>> Map Debt and have all descendants be joined-subclasses, then NH >> >> >>>> should be >> >> >>>> happy with your association because it knows how they're all >> linked >> >> >>>> together >> >> >>>> Map your collection as a many-to-any, which is a polymorphic >> >> >>>> association >> >> >>>> which allows for these kind of things; however, they can be pretty >> >> >>>> tricky to >> >> >>>> figure out how to put together. >> >> >>>> >> >> >>>> I would personally side with 1, but that's just me. As far as I'm >> >> >>>> aware we >> >> >>>> don't support many-to-any's in FNH, so you'd have to map that >> >> >>>> particular >> >> >>>> entity with hbm.xml. >> >> >>>> On Thu, Jan 14, 2010 at 2:11 PM, Mark Nijhof < >> [email protected]> >> >> >>>> wrote: >> >> >>>>> >> >> >>>>> Hi, >> >> >>>>> >> >> >>>>> I have an issue mapping an IList<BaseClass> where the different >> >> >>>>> concrete types are in the list. I think I need a discriminator >> but I >> >> >>>>> am not sure actually. >> >> >>>>> >> >> >>>>> Used CodePast for some syntax highlighting: >> >> >>>>> http://codepaste.net/k97k9y >> >> >>>>> >> >> >>>>> -Mark >> >> >>>>> >> >> >>>>> -- >> >> >>>>> 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]<fluent-nhibernate%[email protected]> >> . >> >> >>>>> For more options, visit this group at >> >> >>>>> http://groups.google.com/group/fluent-nhibernate?hl=en. >> >> >>>>> >> >> >>>>> >> >> >>>>> >> >> >>>> >> >> >>>> >> >> >>>> -- >> >> >>>> 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]<fluent-nhibernate%[email protected]> >> . >> >> >>>> For more options, visit this group at >> >> >>>> http://groups.google.com/group/fluent-nhibernate?hl=en. >> >> >>>> >> >> >>>> >> >> >>> >> >> >> >> >> > >> >> >> >> -- >> >> 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]<fluent-nhibernate%[email protected]> >> . >> >> For more options, visit this group at >> >> http://groups.google.com/group/fluent-nhibernate?hl=en. >> >> >> >> >> >> >> > >> > >> > -- >> > 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]<fluent-nhibernate%[email protected]> >> . >> > For more options, visit this group at >> > http://groups.google.com/group/fluent-nhibernate?hl=en. >> > >> > >> >> -- >> 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]<fluent-nhibernate%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/fluent-nhibernate?hl=en. >> >> >> >> > > -- > 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]<fluent-nhibernate%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/fluent-nhibernate?hl=en. > >--
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.
