我想知道如何将XML文件映射到C#对象。
这是我的XML文件:
<MyXML>
<Suppliers>
<Supplier
SupplierID="1"
SupplierName="Test"
SupplierContact="Test"
SupplierPhone="0612345678"
SupplierEmail="Test@Test.nl"
SupplierAddress="Test"
SupplierSuburb="Test"
SupplierPostcode="1234QE"></Supplier>
</Suppliers>
<Genres>
<Genre
GenreID="1"
GenreName="Test"></Genre>
</Genres>
<Authors>
<Author
AuthorID="1"
AuthorName="Test"
AuthorSurName="Test"
AuthorPlaceOfBirth="Test"
AuthorDoB="2000-07-06"></Author>
</Authors>
<Publishers>
<Publisher
PublisherID="1"
PublisherName="Test"
PublisherContact="Test"
PublisherPhone="Test"
PublisherEmail="Test"
PublisherAddress="Test"
PublisherSuburb="Test"
PublisherPostcode="Test"></Publisher>
</Publishers>
<Inventories>
<Inventory
InventoryID="1"
Title="Test"
WholeSale="Test"
MarkUp="Test"
Discount="Test"
QuantityInStock="Test"
GenreID="1"
SupplierID="1"></Inventory>
</Inventories>
<Books>
<Book
InventoryID="1"
PublishYear="2000-10-10"
CoverType="Test"
PublisherID="1"></Book>
</Books>
<Author_Books>
<Author_Book
AuthorID="1"
InventoryID="1"></Author_Book>
</Author_Books>
<Customers>
<Customer
CustomerID="1"
CustomerName="Test"
CustomerSurname="Test"
CustomerPhone="0612345678"
CustomerEmail="Test"
CustomerAddress="Test"
CustomerPostcode="Test"
CustomerDiscount="100"></Customer>
</Customers>
<Receipts>
<Receipt
ReceiptID="1"
CustomerID="1"
Date="2018-04-01"></Receipt>
</Receipts>
<Purchases>
<Purchase
ReceiptID="1"
InventoryID="1"
Quantity="3"
AmountPaid="91"></Purchase>
</Purchases>
</MyXML>
我不知道如何将其映射到对象。这是因为它包含来自多个表的数据。我当时在考虑数据集,但是最好的方法是什么?我环顾四周,但没人能真正解释他们的遮阳篷。