gpt4 book ai didi

c# - 实体数据源包含功能

转载 作者:行者123 更新时间:2023-12-04 04:37:39 25 4
gpt4 key购买 nike

我正在使用 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) 在 table B 中有一个外键(Employee_Personal_Info)。因此我的 include声明有效。

这是我的问题><
使用我上面的例子。让我们说 table Atable B 中有一个外键和 table Btable C 中有一个外键.使用我的 gridviewentity datasource我如何使用 include从表 C 中获取值的功能。表 A 只能访问表 B(因此我可以从表 B 中获取值)但我需要表 C 中的值(我不能 include 表 C 在我的 entity datasource 中,因为 A和 C 没有链接)。

最佳答案

您可以通过将 Include 中的相关属性链接在一起来实现此目的。属性如下:Employee_Personal_Info.TableC .

关于c# - 实体数据源包含功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19451930/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com