How to use fluent nhibernate to map a value type c

2019-08-22 15:19发布

.........

<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.

2条回答
Juvenile、少年°
2楼-- · 2019-08-22 15:26
HasMany(x => x.Contacts).AsSet().KeyColumn("Ad_Id").Element("Contact");
查看更多
Summer. ? 凉城
3楼-- · 2019-08-22 15:39

You could try with the following map:

HasMany<string>(x => x.Contacts).AsElement("Ad_Id");
查看更多
登录 后发表回答