Business Logic Framework - Tutorial 40:
This tutorial demonstrate the way you can create projections but not rely on the anonymous type, rather you can use the business object instance, and it honors the projection you specified in your LINQ query.
| using (Customers customers = new Customers()) |
| { |
| var results = from c in customers |
| select new { ID = c.CustomerID, First = c.FirstName, Last = c.LastName }; |
| customers.Find(); |
| this.GridView1.DataSource = customers.ResultSet; |
| this.GridView1.DataMember = customers.GetResultSetName(); |
| Using customers As Customers = New Customers() |
| Dim results = From c In customers _ |
| Select New With {.ID = c.CustomerID, .First = c.FirstName, .Last = c.LastName} |
| customers.Find() |
| Me.GridView1.DataSource = customers.ResultSet |
| Me.GridView1.DataMember = customers.GetResultSetName() |
| End Using |
