开发者

Fluent NHibernate AutoMap

I have a qouestion regarding the AutoMap xml generation. I have two classes:

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; }
}

The generated sequences of xml files are: For User class:

<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">
  &l开发者_如何学运维t;column name="User_id" />
</many-to-one>

I don't see the inverse=true attribute for the User mapping. Is it a normal behavior, or I made a mistake somewhere?


The default convention is not to add the inverse attribute. You will have to overwrite the convention to change that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜