CTP5 Fluent API与Join表的一对一关系 [英] CTP5 Fluent API One-to-One relationship with Join tables

查看:111
本文介绍了CTP5 Fluent API与Join表的一对一关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,

Hello All,

我有一个连接表,在连接表的两边一对一匹配。比方说,我有客户,我有地点(或地址)类,我的连接表是customer_location_lookup,每个客户只能在一个位置,每个位置
只能有一个客户,这在CTP4中工作,但我我无法使用CTP5进行映射,非常感谢任何类型的帮助。

I have a join table which a one to one match on either side of the join table. Say for example I have customers and I have Locations (or Address) classes and my join table is customer_location_lookup, each customer can be only at one location and each location can have only one customer, this worked in CTP4, but I am not able map this using CTP5, any kind off help is greatly appreciated.

谢谢,

mm

推荐答案

在CTP4中

  ;            this.HasOptional(c => c.Location).WithRequired(l => l.Customer)

            this.HasOptional(c => c.Location).WithRequired(l => l.Customer)

                 .Map(" dbo.customer_location_lookup",(c,l)=> new

                .Map("dbo.customer_location_lookup", (c, l) => new

          {

                {

            cust_id = c.id,

                    cust_id = c.id,

            loc_id = l.id,

                    loc_id = l.id,

          });

                });

这个工作正常,但无法通过CTP5获得此映射。

and this worked fine, but can't get this mapping with CTP5.

谢谢。


这篇关于CTP5 Fluent API与Join表的一对一关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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