There is an extension method in the HbmMapping class "AsString()" , please create a simple case with two classes, and one many-to-one generate the mappings and paste here. I
2011/7/13 Maximilian Raditya <[email protected]> > I just noticed this. I've just tried it my domain model and it seems like a > bug. It ends up creating two columns for the same association, one without > Id and one with Id. I think Before* events should override existing column > definition, not add a new one. > > I think you can report this in JIRA. > > > > > -- > Regards, > > Maximilian Haru Raditya > > > > > > > On Wed, Jul 13, 2011 at 11:12 AM, asher newcomer <[email protected]>wrote: > >> Thanks José, and yes that post from Fabio is where I've drawn my >> inspiration here. My code is almost identical to the following line from >> his: >> >> mapper.BeforeMapManyToOne += (insp, prop, map) => >> map.Column(prop.LocalMember.GetPropertyOrFieldType().Name + "Id"); >> >> My particular example is actually not a bidirectional relationship (though >> I do have some in my domain), but I don't see why that should matter. My >> 'Currency' object in this case does not have an 'Orders' property. .I'd only >> want to override the column naming convention for one side of the >> relationship in any case. With the other side of the relationship >> (Currency.Orders), I'd be happy keeping the default behavior. >> >> >> On Tue, Jul 12, 2011 at 11:47 PM, José F. Romaniello < >> [email protected]> wrote: >> >>> No problem Asher, now we are talking. >>> I think it is not a bug, but you might be mapping a bidirectional >>> relationship.. >>> >>> Like Order.Currency and Currency.Orders .. or something alike. If that is >>> your case, you are overriding only one of the mappings the one for >>> ManyToOne. >>> Please, check what Fabio did in this post >>> http://fabiomaulo.blogspot.com/2011/04/nhibernate-32-mapping-by-code_13.html >>> >>> 2011/7/13 asher newcomer <[email protected]> >>> >>>> Apologies for the offense. The name is a reference to the Eddie Murphy >>>> movie Coming to America: >>>> >>>> http://www.youtube.com/watch?v=7ef0JqH67V8 >>>> >>>> I'll go ahead and change it. I had frankly forgotten it was set as >>>> such. >>>> >>>> On Tue, Jul 12, 2011 at 11:38 PM, José F. Romaniello < >>>> [email protected]> wrote: >>>> >>>>> The name that you have used to send this mail ( SexualChocolate ) is >>>>> inappropriate and *it is not even funny*. >>>>> I hope the guys in this forum answer you with the same level of >>>>> seriousness. >>>>> >>>>> 2011/7/12 SexualChocolate <[email protected]> >>>>> >>>>>> Trying out the new ConventionModelMapper (just awesome, btw), and >>>>>> can't get the following to work correctly: >>>>>> >>>>>> mapper.BeforeMapManyToOne += (insp, typ, map) => >>>>>> map.Column(typ.LocalMember.GetPropertyOrFieldType().Name + "Id"); >>>>>> >>>>>> Let's say for example that I have a 'Order' object which has a >>>>>> 'Currency' property in a many to one relationship. I want the >>>>>> following schema: >>>>>> >>>>>> create table Order( >>>>>> [other columns] >>>>>> CurrencyId INT >>>>>> ) >>>>>> >>>>>> But when I apply the above code it's generating: >>>>>> >>>>>> create table Order( >>>>>> [other columns] >>>>>> CurrencyId INT >>>>>> Currency INT >>>>>> ) >>>>>> >>>>>> Am I going about this incorrectly or is this a bug? >>>>>> >>>>>> Thank you in advance >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "nhusers" 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/nhusers?hl=en. >>>>>> >>>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "nhusers" 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/nhusers?hl=en. >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "nhusers" 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/nhusers?hl=en. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "nhusers" 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/nhusers?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "nhusers" 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/nhusers?hl=en. >> > > > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" 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/nhusers?hl=en. > -- You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en.
