I need to realise such structure:
Emplooyee:
- ID
- First Name
- Last Name
- Birth Date
- Customers
- ID
- Name
- Address
- Phone
- More then 1000 employees
- Business
- ID
- Name
- Description
Each employee may have more than one customer, all data should be stored/loaded to/from xml file using xml-serialization, business fields should be stored in xml as attributes.
public class AllEntities
{
public AllEntities()
{
Create();
}
public List<Employee> allEmployees { get; set; }
public List<Customer> allCustomers { get; set; }
public List<Business> allBusiness { get; set; }
private void Create()
{
allCustomers = new List<Customer> { new Customer ("Company1", "Minsk", "1236547", "trata@tut.by", false),
new Customer("Company2", "Minsk", "7896589", "itr@tut.by", false)};
allBusiness = new List<Business> { new Business("Programming", "Short description"),
new Business("Desin", "Short description")};
allEmployees = new List<Employee> { new Employee("Alex", "Malash", "mal@tut.by", new DateTime(1990, 5, 9), allCustomers, allBusiness[0]),
new Employee("Ira", "Vashnko", "ira@tut.by", new DateTime(1990, 9, 1), new List<Customer> { allCustomers[0] }, allBusiness[1]),
new Employee("Igor", "Loshara", "igor@tut.by", new DateTime(1990, 1, 8), allCustomers, allBusiness[0])};
}
}
When I use DataContractSerializer, I can't create attributes, and when I use XmlSerializer, at deserializetion, there are mismatch in the same ojects(Customer) in different employees(there are some different objects with same filds).
what can I try?