Hi,

I have a few entities that have an Address, in most of the classes they are 
mapped as component. This done via AutoMapping with:

    public override bool IsComponent(Type type)
    {
        return type == typeof(Address);
    }

But one of my entities now needs a collection of Addresses, AutoMapper 
doens't pick this up, so I made an override like this:

    public class ConsultantMappingOverride : IAutoMappingOverride<Consultant
>
    {
        public void Override(AutoMapping<Consultant> mapping)
        {
            mapping.HasMany(c => c.WorkAddresses)
                .AsBag()
                .Table("`ConsultantWorkAddress`")
                .Component(c =>
                               {
                                   c.Map(a => a.Street);
                                   c.Map(a => a.HouseNumber);
                                   ...
                               });
        }
    }

In fact this seems to work, but now I have my Address automapped as 
component and I had to do it manually for the HasMany. Is there a better 
way?

Jochen

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/fluent-nhibernate/-/ZfSkjuH5_GYJ.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to