>
> I was hoping I could write a convention to apply every time I mapped a
> component. Is there anything exposed by IPropertyInstance or
> IComponentInstance that would help me do this?


Not at the moment. You can inspect the properties and even the column names,
but you can't change them, because you can't get at a writeable section of
what elements a componentInstance contains (outside of high level attributes
like "Update, Insert, and Nullable).

That's a feature that would be worth adding though.

On Tue, Jan 19, 2010 at 1:39 PM, cliff vaughn <[email protected]>wrote:

> I can't help you there since i'm not an automapper.  Try this though:
>
>
> http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/08/13/a-fluent-interface-to-nhibernate---part-2---value.aspx
>
> it's what i do
>
> On Tue, Jan 19, 2010 at 7:13 PM, Kenneth Cochran <
> [email protected]> wrote:
>
>> I hadn't noticed that before. Thanks, that'll work as a fallback.
>>
>> The Address class is used in several places throughout my application
>> and I have several more similar classes. I was hoping I could write a
>> convention to apply every time I mapped a component. Is there anything
>> exposed by IPropertyInstance or IComponentInstance that would help me
>> do this?
>>
>> On Jan 19, 12:13 pm, cliff vaughn <[email protected]> wrote:
>> > there's an extra parameter on the Map() method where you can specifiy a
>> > column name.
>> >
>> > On Tue, Jan 19, 2010 at 4:32 PM, Kenneth Cochran
>> > <[email protected]>wrote:
>> >
>> >
>> >
>> >
>> >
>> > > 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%[email protected]><fluent-nhibernate%2Bunsubscr
>> [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]<fluent-nhibernate%[email protected]><fluent-nhibernate%2Bunsubscr
>> [email protected]>
>> > > .
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/fluent-nhibernate?hl=en.
>> >
>> > --
>> > thanks
>> >
>> > cliff
>>
>> --
>> 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%[email protected]>
>> .
>>
>> For more options, visit this group at
>> http://groups.google.com/group/fluent-nhibernate?hl=en.
>>
>>
>>
>>
>
>
> --
> thanks
>
> cliff
>
> --
> 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%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>
>


-- 
- Hudson
http://www.bestguesstheory.com
http://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.

Reply via email to