【发布时间】:2013-10-27 10:20:51
【问题描述】:
我正在使用Linq to Entity 和Entity Datasource。我有一个包含我所有表格的edmx 文件。我正在尝试在 entity datasource 属性上使用包含功能。
<asp:EntityDataSource ID="EntityDataSource2" runat="server"
ConnectionString="name=sspEntities" DefaultContainerName="xxx"
EnableFlattening="False" EntitySetName="Employee_Financial"
Include="Bank_Branch,Employee_Personal_Info,COA" EnableDelete="True" >
</asp:EntityDataSource>
这是我的一个数据源的示例。
Text='<%# Eval("Employee_Personal_Info.Firstname") + " " + Eval("Employee_Personal_Info.Surname") %>'></asp:Label>
这就是我在gridview(标签)中实现它的方式。
现在我可以这样做了,因为 table A (Employee_Financial) 在 table B(Employee_Personal_Info) 中有一个外键。因此我的include 声明有效。
这是我的问题>table A 在table B 中有一个外键,而table B 在table C 中有一个外键。使用我的gridview 和entity datasource 如何使用include 功能从表C 中获取值。表A 只能访问表B(因此我可以从表B 中获取值)但我需要表中的值C(我不能在我的entity datasource 中include 表C,因为A 和C 没有链接)。
【问题讨论】:
标签: c# linq include linq-to-entities entitydatasource