问题
I have a Custom Type on Fluent NHibernate and I need to map it to a collection of its type, using HasMany association. However, Fluent Nhibernate doesn't let me indicate on HasMany that its about a custom type like I do in my regular types.
This is my code:
HasMany(x => x.AvailablePaymentOptions)
.KeyColumn("OFFER_ID")
.Cascade.None()
.KeyNullable()
.Not.LazyLoad();
Any thoughts?
Thanks
回答1:
Finish not using the custom type, but instead, mapping a component:
HasMany(x => x.AvailablePaymentOptions)
.Table("MY_TABLE")
.KeyColumn("MY_COLUMN")
.Component(component =>
{
//MAP YOUR CUSTOM TYPE HERE
})
.Cascade.None()
.KeyNullable()
.Not.LazyLoad();
来源:https://stackoverflow.com/questions/15258635/map-a-collection-of-custom-types-on-fluent-nhibernate