C # отображение документа XML, который содержит данные нескольких таблиц - PullRequest
0 голосов
/ 07 ноября 2018

Мне интересно, как я могу сопоставить файл 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>

Я просто понятия не имею, как я могу сопоставить это с объектами. Это потому, что он содержит данные из нескольких таблиц. Я думал о наборах данных, но как лучше всего это сделать? Я осмотрелся вокруг, но никто не объясняет их ужас.

...