nTier 中的 .Net 声明式数据绑定
我有一个现有的 .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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论