流利的NHibernate - HasMany()。WithKeyColumnName [英] Fluent NHibernate - HasMany().WithKeyColumnName

查看:100
本文介绍了流利的NHibernate - HasMany()。WithKeyColumnName的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从Google代码中获得了最新版本的Fluent,自从我上次使用它之后,似乎有一些映射已经发生了变化。

以前我可以映射关系当我加入的ID在第二个表中有一个不同的名字时使用以下内容:

  HasMany(x => x。角色).WithTableName( tbl_Roles)WithKeyColumn( 角色ID); 

最新版本的Fluent是如何完成的?



Thanks

解决方案

  HasMany(x => x.Roles)
.WithTableName(tbl_Roles)
.KeyColumns.Add(RoleId);

添加了多列支持,所以方法签名需要改进才能清楚发生了什么。

I just got the latest version of Fluent from Google code and it seems some of the mapping has changed since I last used it.

Previously I could Map a relationship using the following when the id I was joining on had a different name in the second table

HasMany(x => x.Roles).WithTableName("tbl_Roles").WithKeyColumn("RoleId");

How is done in the latest release of Fluent?

Thanks

解决方案

HasMany(x => x.Roles)
  .WithTableName("tbl_Roles")
  .KeyColumns.Add("RoleId");

Multiple column support was added, so the method signature needed to be improved to make it clear what's happening.

这篇关于流利的NHibernate - HasMany()。WithKeyColumnName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆