I've a workarround, but I don't know if is the best way...
AutoPersistenceModel....
.ForTypesThatDeriveFrom<Store>(x => x.HasMany(x =>
x.Stuff).KeyColumnNames.Add("EmployeeId").Inverse())
nuffsaid escribió:
> I'm having the exact same problem. Did you find a solution for this?
> Any help appreciated.
>
>
> On Mar 27, 11:06 am, Filip Kinsky <[email protected]> wrote:
>
>> I have situation like Employee.Store vs Store.Stuff in this
>> sample:http://wiki.fluentnhibernate.org/show/GettingStarted%3A+First+Project
>> . I use ClassMap<T> for my mappings like in the sample. I'd like to
>> use convention to set DB column name to Property.Name +
>> "Id" (resulting to EMPLOYEE.STOREID). When I specify just
>> IReferenceConvention like this:
>>
>> public void Apply(IManyToOnePart target)
>> {
>> target.ColumnName(target.Property.Name +
>> "Id");
>> }
>>
>> the result is that the field is duplicated because the
>> defaultIHasManyConventiongenerates "Store_Id" field. So I have now in the
>> table "Store_Id" and "StoreId" both. How should I define
>> theIHasManyConvention? In this sample case it would work to define it
>> from generic collection parameter, but that's just because the
>> Employee.Store property name is same as the Store type name. I can't
>> find any solution how to build conventions when I don't have the
>> property name same as underlying type name. Like when I'd rename
>> Employee.Store Employee.ParentStore - how should I
>> setupIHasManyConventionwhen I want to map to "ParentStoreId" column name?
>>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---