如何使用流利的nhibernate映射值类型集合? [英] How to use fluent nhibernate to map a value type collection?
本文介绍了如何使用流利的nhibernate映射值类型集合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< property name =Title/>
< key column =Ad_Id>< / key>
< / set>
.........
HasMany(x => x.Contacts).AsSet(),这是我用于流畅的nhibernate映射的语句。它不起作用。联系人是字符串的集合。
解决方案
HasMany(x => x.Contacts ).AsSet()KeyColumn( Ad_Id)元素( 联系人)。。
.........
<property name="Title" />
<set name ="Contacts" lazy="false" table ="Ad_Contacts">
<key column="Ad_Id"></key>
<element type ="String" column="Contact" not-null="true"></element>
</set>
.........
HasMany(x => x.Contacts).AsSet() , which is the statement I used for fluent nhibernate mapping. It doesn't work. Contacts is a collection of string.
解决方案
HasMany(x => x.Contacts).AsSet().KeyColumn("Ad_Id").Element("Contact");
这篇关于如何使用流利的nhibernate映射值类型集合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文