映射中的重复列用于收集

时间:2013-04-17 05:30:05

标签: fluent-nhibernate

I have a Mapping file of Table XX with composite key XX_ID and A_ID

     class XX
    {
     CompositeId()
                  .KeyProperty(x => x.Id, "XX_ID")
                  .KeyReference(x => x.A, "A_ID");
    }

Having Another Table YY with Composite key YY_ID and A_ID.

  class YY
    {
     CompositeId()
                  .KeyProperty(x => x.Id, "YY_ID")
                  .KeyReference(x => x.A, "A_ID");
    }

Now I am Creating many-To-many relationship in between XX and YY with common table XX_YY in Table XX so Class XX is written Like this.

   class XX
    {
     CompositeId()
                  .KeyProperty(x => x.Id, "XX_ID")
                  .KeyReference(x => x.A, "A_ID");


      HasManyToMany(x => x.XXList)
                 .Table("XX_YY")
                 .ParentKeyColumns.Add("XX_ID", "A_ID")
                 .ChildKeyColumns.Add("YY_ID", "A_ID")
                 .Cascade.All()
                 .LazyLoad();   
    }

its giving me Error:-
Repeated column in mapping for collection: XX column: A_ID

0 个答案:

没有答案