在Fluent配置中指定“连接表”名称 [英] Specifying 'Join Table' names in Fluent Configuration

查看:78
本文介绍了在Fluent配置中指定“连接表”名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


Andrew Peters在这个帖子中回答了指定自定义表名的方法。

The way to specify custom table names was answered by Andrew Peters in this thread.

http://social.msdn.microsoft.com/Forums/en/adonetefx/thread/e10a3cee-1a85-4f00-9ffe-df13b71d3d64

&NB sp;

   &NBSP;>>   modelBuilder.Entity< Foo>()。MapSingleType()。ToTable(" foos");

    >>  modelBuilder.Entity<Foo>().MapSingleType().ToTable("foos");

适用于单个表格。然而,我想知道,我们如何命名Join Tables以使它们与我们重写的表名一致?

That works for single tables.  I wonder, however, how can we name Join Tables so that they are consistent with our overridden table names?

也许在RTM中,将从RTM中取出已创建的JoinTable名称自定义集名称?

Perhaps at RTM the dervied JoinTable names will be taken from the custom set names?

是否可以通过流畅的API指定特定名称。

Is it possible to specify a specific name via the fluent API.

谢谢!


推荐答案

你的意思是这样的(CTP4)?:

You mean something like this (CTP4)?:


a.HasMany(x => x.Bs).WithMany()
 .Map("As_Bs", (a, b) => new
 {
 	ID_A = a.ID,
 	ID_B = b.ID,
 });


这篇关于在Fluent配置中指定“连接表”名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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