>
> Should AutoMap.Component return down to Auto map for the component
>
instead of just map so I don't need to have my redundant mappings


I'm not quite sure what you mean here Chris.

 In the second one for <Order> is there anyway I can reach back up to
>
convention.GetComponentColumnPrefix = type => string.Empty;


There's not, but you could specify your convention to be something like
this:

convention.GetComponentColumnPrefix = property =>
{
  if (property.PropertyType == typeof(Address) && property.DeclaringType ==
typeof(Order))
    return "Ship";
  else
    return property.PropertyType.Name;
};

that's from memory, so it may not be exact, but you'd check the type that
the property is declared in to see if it's Order, then override the column
prefix.

On Sun, Feb 8, 2009 at 9:59 PM, Chris Marisic <[email protected]> wrote:

>
> In my AutoPersistanceModel setup I have this in my mapping
>
> .ForTypesThatDeriveFrom<Customer>(autoMap =>
>                                    {
>                                        autoMap.Id(p =>
> p.Id).GeneratedBy.Assigned().SetAttribute("length", "5");
>                                        autoMap.Map(p =>
> p.CompanyName).Not.Nullable();
>                                        autoMap.Component<Address>(p
> => p.Address, addr =>
>
> {
>
> addr.Map(c => c.Street, "Address");
>
> addr.Map(c => c.State, "Region");
>
> addr.Map(c => c.City, "City");
>
> addr.Map(c => c.Country, "Country");
>
> addr.Map(c => c.PostalCode, "PostalCode");
>
>           });
>                                    })
> .ForTypesThatDeriveFrom<Order>(autoMap =>
>                                 {
>                                     autoMap.References(p =>
> p.ShipVia, "ShipVia");
>                                     autoMap.Component<Address>(p =>
> p.Address, addr =>
>
> {
>
> addr.Map(c => c.Street, "ShipAddress");
>
> addr.Map(c => c.State, "ShipRegion");
>
> addr.Map(c => c.City, "ShipCity");
>
> addr.Map(c => c.Country, "ShipCountry");
>
> addr.Map(c => c.PostalCode, "ShipPostalCode");
>
>        });
>
> })
>
> })
>
> Should AutoMap.Component return down to Auto map for the component
> instead of just map so I don't need to have my redundant mappings
>
> addr.Map(x => x.City, "City");
> addr.Map(x => x.Country, "Country");
>
> In the second one for <Order> is there anyway I can reach back up to
> convention.GetComponentColumnPrefix = type => string.Empty;
>
> That I change that convention ForTypesThatDeriveFrom<Order> to "Ship" ?
> >
>

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

Reply via email to