开发者

FluentNHibernate: can't change key column name for a one-to-many relationship

I have an entity:

public class Message:Entity
    { 
       public virtual IList`<`Message> ReplayMessages { set; get; }
       public virtual Message ParentMessage { set; get; }
    }

I try to override the mapping:
 mapping.HasMany(x => x.ReplayMessages)
      开发者_JAVA百科          .AsSet()
                .KeyColumnNames.Add("ParentId");

but in the hbm.xml file I get:

<set name="ReplayMessages">
      <key column="MessageFk" />
      <one-to-many class="Edi.Core.Model.Message, Edi.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
    </set>

Why the column key name didn't change?


When I use HasMany it looks like this:

HasMany(x => x.OrderItems)
    .KeyColumn("OrderId")
    .AsSet()
    .Cascade.All();

I don't know what KeyColumnNames is used for...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜