Once you have created the schema, a property needs to be changed on it.
Return to the Solution Explorer window, right-click on the XMLSchema1.xsd file, and select Properties
from the context menu, as shown in Figure C-5.
Figure C-5
In the Properties window for the schema, select the property called Build Action. The default value for
this property is None; change it to LinqToXsdSchema, as shown in Figure C-6. This property informs the
project that the schema will be included in the project??™s build process.
351
Appendix C: LINQ to XSD
Figure C-6
The final step is to add some code behind the form. Set the Text property of the second button to Typed,
and double-click the button to display the Click event code for that button.
Before you add the code to the Click event, scroll to the top of the code and add the following
using statement:
using www.AdventureWorks.com.Orders;
Finally, in the Click event for button2, add the following:
var ord = Order.Load("C:\\Wrox\\AppendixC\\Orders.xml");
var total = (from purchaseOrder in ord.OrderDetail
from item in purchaseOrder.
Pages:
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543