I have now a working version with (code snippet...)
.ForTypesThatDeriveFrom<Person>(map=>map.Component<Address>(t=>t.Address, c=> { c.Map(p => p.Line1); c.Map(p => p.Line2); c.Map(p => p.PostalCode); c.Map(p => p.City); c.References(p => p.Country); })) but since I have many different value objects this cannot be the solution! I don't want to manually define all my mappings of value objects I wonder if it is not possible to define a convention for the mapping of value objects? Something like AutoPersistenceModel .MapEntitiesFromAssemblyOf<Person>() *.WithConvention(c => c.MapAsComponent = type => IsValueObject(type))* where the function *IsValueObject(...) *is a user defined function... would this be possible? On Thu, Oct 2, 2008 at 11:37 PM, Andrew Stewart < [EMAIL PROTECTED]> wrote: > Hi Gabriel > To be honest mate, no idea- as I've never actually done it with the normal > fluent-nhibernate. > > However if fluent-nhibernate supports it then AutoMapper supports it. > Basically AutoPersitenceModel will map out as much of your model as it can > figure out by it self then it's down to you to provide the extra's. To > attempt to point you in the write direction it should be something like the > below: > > AutopersistenceModel > .MapEntitiesFromAssembly<EntityName>() > .Where( t => t.Namespace=="YourNamespace") > .ForTypesDerivedFromType<Person>( map => > { > /// Normal Fluent nibernate code goes here. > }) > .Configure(); > > This is all from memory, so it's probably slightly off. I'll be in work in > the morning and can probably send you a more accurate example then. > > Good luck, let me know how you get on. > > Andy > > On Thu, Oct 2, 2008 at 10:13 PM, Gabriel Schenker <[EMAIL PROTECTED]>wrote: > >> >> How do I configure my AutoPersistenceModel when using components? E.g >> >> Person-->Address >> >> where Person is an entity and Address is a value object (=component)? >> >> > > > -- > ================= > I-nnovate Software - Bespoke Software Development, uk wirral. > http://www.i-nnovate.net > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibernate@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---