问题
.........
<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.
回答1:
You could try with the following map:
HasMany<string>(x => x.Contacts).AsElement("Ad_Id");
回答2:
HasMany(x => x.Contacts).AsSet().KeyColumn("Ad_Id").Element("Contact");
来源:https://stackoverflow.com/questions/1243323/how-to-use-fluent-nhibernate-to-map-a-value-type-collection