Map a collection of custom types on fluent nhibernate

╄→尐↘猪︶ㄣ 提交于 2020-01-15 11:14:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!