错误'必须指定实体X的所有关键属性的映射',但我已映射它们 [英] Error 'Must specify mapping for all key properties of the Entity X' but I have mapped them

查看:96
本文介绍了错误'必须指定实体X的所有关键属性的映射',但我已映射它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人可以帮助我,因为我的目标是学习LINQ to Entities,而我在使用Visual Web Developer Entity Designer方面遇到了一些问题。

推荐答案

如果我理解正确你有两个表:
表:
产品(品牌,产品名称) )
购买(NumberOfUnitsInTrolly,TrolleyNumber)

您可以将两个表中的字段映射到单个实体(实体:BasketItems)。目前,我们只允许在PK上加入实体时将实体拆分为多个表。基本上,您描述的方案仅在两个表"产品"和"购买"与其PK相关时才有效。

If I understand correctly you have two tables:
Tables:
Products (Brand, ProductName)
Purchases (NumberOfUnitsInTrolly, TrolleyNumber)

You map fields from both tables to a single entity (Entity: BasketItems). Currently we only allow splitting entity into multiple tables when they are joined on PK. Basically the scenario you described will only work if both tables "Products" and "Prurchases" are related on their PKs.


这篇关于错误'必须指定实体X的所有关键属性的映射',但我已映射它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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