Ok here is the correct mapping which works. IsBaseType = type=>type.IsGenericType && type.GetGenericTypeDefinition() == typeof(DomainEntityBase<,>));
Thx for Help. Steve Steve Wagner schrieb: > If i did this, ive got the joined subclass. > > But this could not be right. In example the basetype of the User object > is not DomainEntityBase<,> it is DomainEntityBase<User,Guid> instead. > > James Gregory schrieb: >> IsBaseType gets called against every type in your assembly, and it's >> supposed to return true only for the actual base types. Looking at your >> IsBaseType, you're checking the BaseType, which seems wrong to me. That'll >> return true for any type that has a BaseType that matches, not that the type >> itself is a base type. >> You should just be able to do: >> >> IsBaseType = >> type => type == typeof(DomainEntityBase<,>); >> >> On Fri, Feb 6, 2009 at 12:30 PM, Steve Wagner <[email protected]> wrote: >> >>> Ok ive tryed it again, but is dose not work. Here is my code: >>> >>> AutoPersistenceModel >>> .MapEntitiesFromAssemblyOf<User>() >>> .Where( t=>t!=typeof(User) ) >>> .WithConvention( new Conventions >>> { >>> IsBaseType = (delegate( Type type ) >>> { >>> return (type.BaseType != null && >>> type.BaseType.IsGenericType && >>> type.BaseType.GetGenericTypeDefinition() >>> == typeof(DomainEntityBase<,>)); >>> }), >>> FindIdentity = (info => info.Name == "Id"), >>> IdConvention = (part => part.GeneratedBy.GuidComb()) >>> } ) >>> .Configure( config ); >>> >>> The IsBaseType action evaluates to true for all object i want (tryed >>> it). But the above code dose not creates create any mapping, only if i >>> remove the IsBaseType delegate. >>> >>> Suggestions? >>> >>> Steve >>> >>> Steve Wagner schrieb: >>>> Hmm ok, have already tryed it this way before but with no success. I >>>> will try again. >>>> >>>> Chris Marisic schrieb: >>>>> I believe what you are looking for is this >>>>> >>>>> .WithConvention(c=>c.IsBaseType = baseType => baseType == typeof >>>>> (SomeBaseObject)) >>>>> >>>>> Add that to your creation of the AutoPersistenceModel at some point >>>>> after the .MapEntitiesFromAssemblyOf<>() statement. >>>>> >>>>> On Feb 5, 3:39 pm, Steve Wagner <[email protected]> wrote: >>>>>> Hi, all my Domain objects have a common generic base class which >>>>>> provides equality. >>>>>> >>>>>> If i use AutoPersistenceModel with them, it adds the base class for >>> each >>>>>> object and then it adds the object itself as joined subclass. How can i >>>>>> prevent this behavior? >>>>>> >>>>>> And second, what is the best way to setup an exception? I have on >>> object >>>>>> which i have to map with and assigned id generator instead of an >>> guidcomp. >>>>>> Greets, >>>>>> Steve >>>>>> > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
