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 513 | Next

Scott Klein

"Professional LINQ"

Contact.Wherei
("it.MiddleName IS NOT NULL").OrderBy("it.LastName");
this.cbosalesPerson.DataSource = salesPerson.Include
("SalesOrderHeader.SalesOrderDetail");
Figure B-9
The first line creates an instance of ObjectContext based on the defined entity. The second line initializes
a new instance of the ObjectContext class. The third line uses the defined and mapped entities to return
all contacts that have a middle name. The fourth line sets the data source of the combo box.
How about the IndexChanged event on the combo? The first line of the following code gets the selected
contact from the combo. Because the ADO.NET Entity Framework handles the relationships, the rest of
the code gets the sales order detail for the selected contact, and then populates the grid.
Contact person = (Contact)cbosalesPerson.SelectedItem;
foreach (SalesOrderHeader soh in person.SalesOrderHeader)
{
object[] row = new object[4];
row[0] = soh.SalesOrderDetail.OrderQty;
row[1] = soh.SalesOrderDetail.ProductID;
row[2] = soh.SalesOrderDetail.UnitPrice;
row[3] = soh.


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