在不相关的视图和表之间创建关联 [英] Create association between unrelated view and table
问题描述
有没有办法在EF中的视图和表格之间建立一种无关联的方式? 有问题的表确实有可能的外键。
Is there a way to establish an association between a view and a table in EF that are not related in any way? The table in question does have the possible foreign key.
查看:员工
字段:employeeID,name
View: Employee
fields: employeeID, name
表:指纹
字段:userID,fingerprintID,supervisorEmployeeID
Table: Fingerprints
fields: userID, fingerprintID, supervisorEmployeeID
此处的目标是获取主管的员工姓名。 指纹记录不会被加载,但我会修改用户的用户ID,这样我就可以获得该用户的指纹记录。 主管
ID有可能在每个指纹记录中有所不同。
The goal here is to get the employee name for the supervisor. The fingerprint records would not be loaded but I would have the user ID of the user to be modified so I can get that user's fingerprint records. There is a possibility that the supervisor ID could be different in each fingerprint record.
我想看看是否有直接的方法来建立关联表和视图之间的EDM,所以我可以创建一个数据库调用(通过RIA服务到Silverlight客户端)。
I'd like to see if there is a straight forward way to establish the association in the EDM between the table and view so I can create one DB call (via RIA services to a silverlight client).
推荐答案
你好,
是的,这是可能的。我正在使用这种协会。只需在视图和表格之间添加关联:supervisorEmployeeID - > employeeID。
Yes, it's possible. I'm using such association. Just add an association between view and table: supervisorEmployeeID -> employeeID.
HTH
这篇关于在不相关的视图和表之间创建关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!