2

我正在使用Linq to EntityEntity 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) 在 (Employee_Personal_Info) 中有一个外键table B。因此,我的include陈述有效。

这是我的问题>< 使用我上面的示例。假设 table A有一个外键,table B并且在 a 中table B有一个外键table C。使用我gridview以及entity datasource如何使用该include功能从表 C 中获取值。表 A 只能访问表 B(因此我可以从表 B 中获取值)但我需要表 C 中的值(并且我不能include在我的表 Centity datasource因为 A 和 C 没有链接)。

4

1 回答 1

3

您可以通过在属性中将相关属性链接在一起来做到这一点,如下所示IncludeEmployee_Personal_Info.TableC

于 2013-10-18T14:29:40.657 回答