Often I need to combine data from multiple tables and display the result in a GridView control.
I can write the Linq inline query in the Page_load event, return an anonymous type that combines all the fields I need and bind the result to the GridView control.
I can write a database view that returns the data I need and write a helper method with a request for this (new and well-known) type that it returns.
I would like to use an approach that allows me to store Linq queries in helper methods, but allows me to access all the attributes that I need in the grid, in their respective data binding expressions. It can be done?
, . , , GridView - <asp:BoundField> ( DataField , Linq).
<asp:BoundField>
, TemplateField Eval Linq, Linq . , , (, ) GridView. Account, , . .
, , . , WinForms, ASP.NET.
, , , . - ICustomTypeDescriptor.
ICustomTypeDescriptor
, , , , , . GetProperties() PropertyDescriptor PropertyDescriptor.GetValue() PropertyDescriptor.SetValue() .
GetProperties()
PropertyDescriptor
PropertyDescriptor.GetValue()
PropertyDescriptor.SetValue()
PropertyDescriptor.Name, ; , , , . , - if - , , ICustomTypeDescriptor.
PropertyDescriptor.Name
UPDATE
, , ASP.NET ICustomTypeDescriptor.
, , :
3 -
" ".