实体关系和复合键的问题 [英] Problem with Entity Relationships and Composite Keys

查看:51
本文介绍了实体关系和复合键的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在.edmx中表达了一对表。目前尚不清楚这是否是EF的基本限制,或者我只是没有正确地做到这一点。



假设我有两个表,客户端 ClientAccount 。 ClientAccount具有由客户端ID和帐户ID组成的复合主键。



每个id在其源表上都是唯一的,但ClientAccount的唯一主键是composite:(ClientId,AccountId)。一个帐户可以与多个客户关联,每个客户通常有六个他们使用的帐户。



这很容易表达:






代码段

解决方案

您好,


当我和你一样时,我没有问题。


你能否发送你的ssdl和msl关系部分。


谢谢,


Matthieu



I'm having touble expressing a pair of tables in .edmx.  It's not clear whether this is a fundamental limitation of EF, or I'm just not doing it correctly.

 

Suppose I have two tables, Client and ClientAccount.  ClientAccount has a composite primary key consisting of a client id, and an account id.

 

Each id is unique on its source table, but the unique primary key for ClientAccount is composite: (ClientId, AccountId).  One account can be associated with several clients, and each client generally has a half-dozen accounts they make use of.

 

This is easy enough to express:

 

Code Snippet

解决方案

Hello,

I have no problem when I do the same as you.

Can you send your ssdl and msl relationship part please.

Thanks,

Matthieu

 


这篇关于实体关系和复合键的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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