Component. My class map looks something like this:
public class MyClassMap : ClassMap<MyClass>
{
public MyClassMap()
{
//...
Component(x => x.BusinessAddress, m =>
{
m.Map(x =>
x.StreetAddress);
m.Map(x =>
x.City);
m.Map(x =>
x.State);
m.Map(x =>
x.ZipCode);
});
Component(x => x.PrincipalLocationAddress, m =>
{
m.Map(x
=> x.StreetAddress);
m.Map(x
=> x.City);
m.Map(x
=> x.State);
m.Map(x
=> x.ZipCode);
});
}
}
On Jan 19, 11:22 am, Hudson Akridge <[email protected]> wrote:
> Are you mapping Address as a Reference or a Component. There's a big
> difference depending on how you're doing it.
>
> On Tue, Jan 19, 2010 at 10:13 AM, Kenneth Cochran <[email protected]
>
>
>
>
>
> > wrote:
> > I have a class that contains two properties of the same type.
>
> > public class Business
> > {
> > //...
> > public Address MailingAddress{get; set;}
> > public Address PrincipleLocation{get;set;}
> > }
>
> > class Address
> > {
> > string StreetAddress{get;set;}
> > string City{get;set;}
> > string State{get;set;}
> > string ZipCode{get;set;}
> > }
>
> > I tried automapping at first, which appears to apply a column naming
> > convention based on the property name by default.
>
> > For reasons I won't go into I had to abandon automapping in favor of
> > fluent mapping. Fluent mappings don't appear to share this convention.
> > A quick look at the generated schema shows only a single set of
> > columns for storing an address. How do I replicate this?
>
> > If automapping is the only way to accomplish I guess I can try mixing
> > automapping and fluent mapping.
>
> > --
> > 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]<fluent-nhibernate%2Bunsubscr
> > [email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/fluent-nhibernate?hl=en.
>
> --
> - Hudsonhttp://www.bestguesstheory.comhttp://twitter.com/HudsonAkridge
--
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.