This question is locked. New answers and comments are not allowed.
I am new to OpenAccess ORM.
Say I have 3 domain models.
1.Employee
a.EmpID
b.EmpName
c.AddressID
2. Address
a. Id
b. Address Line 1
c. Address Line 2
3.Phones
a. Id
b.AddressID
c.PhoneNumber
Employee and Address have 1 to 1 relation. Where as Address and Phone have 1 to Many relation. I can insert the code to DB by:
Employee.Address = Address;
Employee.Address.Phones.Add(Phone1)
context.Add(Employee)
context.savechanges()
But when Updating, I am having problems. I When I use code similar to above
Employee emp = Context.Employees.Where(<some condition>).toList().First();
Address.Phones.Add(Phone1)
emp.Address = Address;
context.savechanges()
, no error is thrown, but Phone and Adress is not getting updated.
I feel like I am doing it all wrong. Can you guide me how to do Update with multiple domain levels in OpenAccess ORM?
Say I have 3 domain models.
1.Employee
a.EmpID
b.EmpName
c.AddressID
2. Address
a. Id
b. Address Line 1
c. Address Line 2
3.Phones
a. Id
b.AddressID
c.PhoneNumber
Employee and Address have 1 to 1 relation. Where as Address and Phone have 1 to Many relation. I can insert the code to DB by:
Employee.Address = Address;
Employee.Address.Phones.Add(Phone1)
context.Add(Employee)
context.savechanges()
But when Updating, I am having problems. I When I use code similar to above
Employee emp = Context.Employees.Where(<some condition>).toList().First();
Address.Phones.Add(Phone1)
emp.Address = Address;
context.savechanges()
, no error is thrown, but Phone and Adress is not getting updated.
I feel like I am doing it all wrong. Can you guide me how to do Update with multiple domain levels in OpenAccess ORM?