Nested Collections
-
I have been struggling with this for a while now and thought it was time to post it to the forum. I have a class library with nested collections. Each collection can contain an employee collection. The employee objects in each nested collection's employees collection can have different properties and different values. My problem is some of the properties will always be the same like FirstName, LastName, etc. Therefore I know that I need to have a main employee collection that all the other employee objects reference so that when I change the firstname all the employee's collections that contain that employee will update the firstname. How do I add an employee collection to each nested collection that references a main employee collection's employee, but I can change some employee properties in each nested collection that are unique to that class. I hope this was not too confusing. Below is a simple example of what I have done and it works correctly so far except for it creates a new object for the same employee for each employee collection. Entities |-Entity ..|-Employees.Employee ..|-Divisions ....|-Division ......|-Employees.Employee ......|-Groups ........|-Group ........|-Employees.Employee Employee |-FirstName |-LastName |-SomeProperty (Could be unique for each nested collection) Any help would be appreciated. -Garrett
-
I have been struggling with this for a while now and thought it was time to post it to the forum. I have a class library with nested collections. Each collection can contain an employee collection. The employee objects in each nested collection's employees collection can have different properties and different values. My problem is some of the properties will always be the same like FirstName, LastName, etc. Therefore I know that I need to have a main employee collection that all the other employee objects reference so that when I change the firstname all the employee's collections that contain that employee will update the firstname. How do I add an employee collection to each nested collection that references a main employee collection's employee, but I can change some employee properties in each nested collection that are unique to that class. I hope this was not too confusing. Below is a simple example of what I have done and it works correctly so far except for it creates a new object for the same employee for each employee collection. Entities |-Entity ..|-Employees.Employee ..|-Divisions ....|-Division ......|-Employees.Employee ......|-Groups ........|-Group ........|-Employees.Employee Employee |-FirstName |-LastName |-SomeProperty (Could be unique for each nested collection) Any help would be appreciated. -Garrett