nTier 中的 .Net 声明式数据绑定

发布于 2024-08-04 23:48:15 字数 1001 浏览 0 评论 0原文

我有一个现有的 .Net 单层 Web 应用程序,它是使用 EntityDatasource 对象在标记中使用声明性数据绑定构建的。我正在从 UI 中提取层(业务逻辑、数据访问)并将其迁移到 ntier 应用程序。

该应用程序使用声明性数据绑定。例如:

<asp:DropDownList ID="ddUsers" runat="server" 
    DataSourceID="edsUsers_DET" DataTextField="UserName" 
    DataValueField="UserID" ondatabound="ddUsers_DataBound">
</asp:DropDownList>

    <asp:EntityDataSource ID="edsUsers" runat="server" 
        ConnectionString="name=MyEntities" DefaultContainerName="MyEntities" 
        EntitySetName="Users" Include="Roles"
        Where="it.Roles.UserID = @UserID" 
        OrderBy="it.ModifyDate DESC">
    <WhereParameters>
         <asp:Parameter Name="UserID" Type="Int32" />
    </WhereParameters>
    </asp:EntityDataSource>

声明式数据绑定是否在 ntier 环境中使用,或者您是否必须手动将数据绑定到业务对象?

如果您可以在应用程序类型中使用声明性数据绑定,是否有人有一些示例可以指出我可以在哪里学习如何实现?

我想我可以从 BLL 执行 LINQ 查询来填充 EntityDataSource,但不确定这是否可行。

EntityDataSouce 对象在 n 层 UI 中占有一席之地吗?

I have an existing .Net single tier web app that is built using declarative data binding in the markup using EntityDatasource objects. I am in the process of extracting out the layers (Business Logic, Data Access) from the UI and migrating this to a ntier app.

This app is using Declarative data binding. e.g.:

<asp:DropDownList ID="ddUsers" runat="server" 
    DataSourceID="edsUsers_DET" DataTextField="UserName" 
    DataValueField="UserID" ondatabound="ddUsers_DataBound">
</asp:DropDownList>

    <asp:EntityDataSource ID="edsUsers" runat="server" 
        ConnectionString="name=MyEntities" DefaultContainerName="MyEntities" 
        EntitySetName="Users" Include="Roles"
        Where="it.Roles.UserID = @UserID" 
        OrderBy="it.ModifyDate DESC">
    <WhereParameters>
         <asp:Parameter Name="UserID" Type="Int32" />
    </WhereParameters>
    </asp:EntityDataSource>

Is declarative data binding used in an ntier environment or do you have to manually data bind to the business objects?

If you can use declarative data bind in the type of app, does anyone have some examples they could point me to where I can learn how to implement?

I figured I could perform LINQ queries from the BLL to populate the EntityDataSource but not sure if this is the way to go or not.

Do EntityDataSouce objects have a place in n-tier UI?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文