views:

73

answers:

1

Hi. 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">
  <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?

A: 

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

Mattias Jakobsson

related questions