SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 514 | Next

Scott Klein

"Professional LINQ"

SalesOrderDetail.LineTotal;
grdOrderDetails.Rows.Add(row);
}
339
Appendix B: LINQ to Entities: The ADO.NET Entity Framework
This last example is a simple one that builds on the first example. The previous example returned the
ProductID from the SalesOrderDetail table. To return the actual product name instead of the just the
ID, Product must be included in the join:
this.cbosalesPerson.DataSource = salesPerson.Include("SalesOrderHeader
.SalesOrderDetail").Include("SalesOrderHeader.Product");
With that, you can grab the product name and display it in the grid.
row[1] = soh.SalesOrderDetail.Product.ProductName
The following sections provide an overview of how to query the entity model and how to work
with objects.
Querying the Entity Data Model
Querying the entity data model is really not that different from the work you did in LINQ to SQL. The
best form is the ObjectQuery class, which you saw earlier:
private AdventureWorksEntities productSalesContext;
productSalesContext = new AdventureWorksEntities();
ObjectQuery salesPerson = productSalesContext.


Pages:
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6