0

我试图了解为什么会出现此错误:

The relationship Client.ChildClients to Client.ChildClients has Inverse specified on both sides. Remove Inverse from one side of the relationship.

我有一个包含以下属性的客户端实体:

    public virtual Iesi.Collections.ISet ChildClients
    {
        get
        {
            return this._ChildClients;
        }
        set
        {
            this._ChildClients = value;
        }
    }

    public virtual Iesi.Collections.ISet ParentClients
    {
        get
        {
            return this._ParentClients;
        }
        set
        {
            this._ParentClients = value;
        }
    }

当我尝试流畅地配置我的映射时,我收到了上面列出的错误。这是我对这些属性的映射:

HasManyToMany<Client>(x => x.ChildClients)
          .Access.Property()
          .AsSet()
          .Cascade.None()
          .LazyLoad()
          .Inverse()
          .Not.Generic()
          .Table("ParentClients_ChildClients")
          .FetchType.Join()
          .ChildKeyColumns.Add("ClientId1", mapping => mapping.Name("ClientId1")
                                                               .Nullable())
          .ParentKeyColumns.Add("ClientId", mapping => mapping.Name("ClientId")
                                                               .Nullable());
HasManyToMany<Client>(x => x.ParentClients)
          .Access.Property()
          .AsSet()
          .Cascade.None()
          .LazyLoad()
          .Not.Generic()
          .Table("ParentClients_ChildClients")
          .FetchType.Join()
          .ChildKeyColumns.Add("ClientId", mapping => mapping.Name("ClientId")
                                                               .Nullable())
          .ParentKeyColumns.Add("ClientId1", mapping => mapping.Name("ClientId1")
                                                               .Nullable());

我试图弄清楚我的问题以及它发生的原因。我在这里做错了什么?

4

1 回答 1

1

在这里解决!问题似乎与流利的 nhibernate 验证器或其他东西有关。希望我知道为什么这会解决它。

于 2012-09-11T14:58:47.323 回答