Maybe our automapping expert Andrew Stewart would like to help out Gabriel
here? (poke poke)

On Fri, Oct 3, 2008 at 8:49 AM, Gabriel Schenker <[EMAIL PROTECTED]>wrote:

> note that I have already written about this topic in this blog post
>
>
> http://www.nhforge.org/blogs/nhibernate/archive/2008/09/06/a-fluent-interface-to-nhibernate-part-2-value-objects.aspx
>
> I have especially looked at DRY
>
>
> On Fri, Oct 3, 2008 at 9:44 AM, Gabriel Schenker <[EMAIL PROTECTED]>wrote:
>
>>
>> How can I easily map the same value object (component in NHibernate)
>> multiple times in an entity and be DRY? I am especially interested in
>> auto-mapping
>>
>> e.g.
>>
>> Employee
>>   --> HomeAddress (type Address)
>>   --> WorkAddress (type Address)
>>
>> where Address is a value object?
>> In Castle ActiveRecord we have the [Nested(...)] attribute. Especially
>> important is the fact that I can provide a column prefix as parameter
>> and this prefix will be prepended to all column names of the mapped
>> component
>> the sample above with Castle ActiveRecord mapping
>>
>> [ActiveRecord]
>> public class Employee {
>>
>>  [Nested("HomeAddress")]
>>  public Address HomeAddress { get; set; }
>>
>>  [Nested("WorkAddress")]
>>  public Address WorkAddress { get; set; }
>>
>>  // other members...
>> }
>>
>> I could imagine a convention which takes the name of the property as
>> column prefix
>>
>>
>
> >
>

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

Reply via email to