问题描述
我有以下表结构:
Table: Plant
PlantID: Primary Key
PlantName: String
Table: Party
PartyID: Primary Key
PartyName: String
PlantID: link to Plant table
Table: Customer
PartyID: Primary Key, link to Party
CustomerCode: String
我想有Customer实体对象以下字段:
I'd like to have Customer entity object with following fields:
PartyID: Primary Key
CustomerCode: String
PartyName: String
PlantName: String
我有麻烦PlantName场(这是从植物表带来我接客户到党和党植物与关联但是我无法连接到客户工厂与关联(因为它没有一个)我无法厂表添加到映射,当我做到这一点 - 我收到以下错误:
I am having trouble with PlantName field (which is brought from Plant tableI connected Customer to Party and Party to Plant with associationsHowever I can not connect Customer to Plant with association ( because it does not have one)I can not add Plant table to mapping, when I do that - I am getting following error:
Error 3024: Problem in Mapping Fragment starting at line 352: Must specify mapping for all key properties (CustomerSet.PartyID) of the EntitySet CustomerSet
删除植物协会工作。任何提示或指示非常AP preciated。
Removing Plant association works.Any hints or directions very appreciated.
推荐答案
您可以通过使用实体对象的参考路径得到这些领域。
You can get these fields by using the reference path on the Entity Object.
要获得PartyName,使用此语法: Customer.Party.PartyName
To get the PartyName, use this syntax: Customer.Party.PartyName
要获得PlantName,使用此语法: Customer.Party.Plant.PlantName
To get the PlantName, use this syntax: Customer.Party.Plant.PlantName
这篇关于ADO.NET实体:从3个表中获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!