0
我有一個映射文件NHibernate的映射+伊賽特
<set name="Friends" table="Friends">
<key column="UserId"/>
<many-to-many class="User" column="FriendId"/>
</set>
我想爲朋友表這將創建指定額外的列。
例如批准(用戶必須同意好友請求)
有沒有簡單的方法?
而且更新
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping namespace="MyVerse.Domain" assembly="MyVerse.Domain" xmlns="urn:nhibernate-mapping-2.2">
<class name="User" table="[User]" lazy="true">
<id name="Id" type="Guid">
<generator class="guid" />
</id>
<property name="DateCreated" type="DateTime" not-null="true" />
<property name="Deleted" type="Boolean" not-null="true" />
<property name="Firstname" type="String" length="100" not-null="true" />
<property name="Lastname" type="String" length="100" not-null="true" />
<bag name="Friends" table="[Friend]">
<key column="UserId"/>
<many-to-many class="Friend" column="FriendId"/>
</bag>
</class>
<class name="Friend" table="[Friend]" lazy="true">
<id name="Id" type="Guid">
<generator class="guid" />
</id>
<property name="DateCreated" type="DateTime" not-null="true" />
<property name="Approved" type="Boolean" not-null="true" />
</class>
</hibernate-mapping>
將導致鏈接到朋友表從朋友表
但是那麼朋友類會是什麼樣子呢?用戶可以將用戶作爲朋友 – jack 2010-04-13 20:13:23
更新帖子 – jack 2010-04-13 20:16:57
所有真正需要開心的是朋友表必須具有批准的布爾列 – jack 2010-04-13 20:27:40