Asp.net application in a n-layered ar开发者_运维知识库chitecture (better if is a DDD architecture).
In the presentation layer I have a grid (let's say telerik radgrid or standard gridview) where I need to show a list of products (product is my entity).
Make sense talking about Linqdatasource provider for the grid? How can I use it in this scenario? Or I should write the binding operations "manully" (intercepiting the binding events and call my getproductlist function from my application layer?
Example are welcome...thanks.
The LinqDataSource/SqlDataSource/ObjectDataSource controls, in my experience, provide little in the way of development time and hinder maintainability. In general, my code for binding to a grid would look something like this:
using(ApplicationService appService = new ApplicationService())
{
RadGrid1.DataSource = appService.GetCollection();
RadGrid1.DataBind();
}
The application service would call the repository, where the Linq query would be performed. Some new techniques such as CQRS where your SQL query would only be 'SELECT * FROM TABLE' may be suited to the DataSource objects but I am left familliar with this.
精彩评论