Map a collection of custom types on fluent nhibern

2019-08-03 18:16发布

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条回答
我欲成王,谁敢阻挡
2楼-- · 2019-08-03 19:00

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();
查看更多
登录 后发表回答