我有关于AutoMap xml生成的问题。 我有两个班:
public class User
{
virtual public Guid Id { get; private set; }
virtual public String Name { get; set; }
virtual public String Email { get; set; }
virtual public String Password { get; set; }
virtual public IList<OpenID> OpenIDs { get; set; }
}
public class OpenID
{
virtual public Guid Id { get; private set; }
virtual public String Provider { get; set; }
virtual public String Ticket { get; set; }
virtual public User User { get; set; }
}
生成的xml文件序列是: 对于用户类:
<bag name="OpenIDs">
<key>
<column name="User_Id" />
</key>
<one-to-many class="BL_DAL.Entities.OpenID, BL_DAL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</bag>
For OpenID class:
<many-to-one class="BL_DAL.Entities.User, BL_DAL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="User">
<column name="User_id" />
</many-to-one>
我没有看到User mapping的inverse = true属性。这是正常的行为,还是我在某处犯了错误?
答案 0 :(得分:0)
默认约定不是添加inverse属性。您将不得不覆盖约定以更改它。