{"action":"opened","issue":{"url":"https://api.github.com/repos/refactorthis/GraphDiff/issues/147","labels_url":"https://api.github.com/repos/refactorthis/GraphDiff/issues/147/labels{/name}","comments_url":"https://api.github.com/repos/refactorthis/GraphDiff/issues/147/comments","events_url":"https://api.github.com/repos/refactorthis/GraphDiff/issues/147/events","html_url":"https://github.com/refactorthis/GraphDiff/issues/147","id":106593206,"number":147,"title":"Nested many to many duplicating entries/ is it possible?","user":{"login":"dmlavigne1","id":14277456,"avatar_url":"https://avatars.githubusercontent.com/u/14277456?v=3","gravatar_id":"","url":"https://api.github.com/users/dmlavigne1","html_url":"https://github.com/dmlavigne1","followers_url":"https://api.github.com/users/dmlavigne1/followers","following_url":"https://api.github.com/users/dmlavigne1/following{/other_user}","gists_url":"https://api.github.com/users/dmlavigne1/gists{/gist_id}","starred_url":"https://api.github.com/users/dmlavigne1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmlavigne1/subscriptions","organizations_url":"https://api.github.com/users/dmlavigne1/orgs","repos_url":"https://api.github.com/users/dmlavigne1/repos","events_url":"https://api.github.com/users/dmlavigne1/events{/privacy}","received_events_url":"https://api.github.com/users/dmlavigne1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-15T16:23:26Z","updated_at":"2015-09-15T16:23:26Z","closed_at":null,"body":"I have the following structure:\r\nParentCompany - Id, Name\r\nChildCompany - Id, Name\r\nEmployee - Id, Name\r\nParentCompanyChildCompany - Id, ChildCompanyId, ParentCompanyId\r\nChildCompanyEmployee - Id, ChildCompanyId, EmployeeId\r\n\r\nMy goal in a POC is to grab all the ParentCompanies, Child Companies, and Employees.  Add a Child Company to a parent by adding a new ParentCompanyChildCompany , then add an employee to the child company by adding a new ChildCompanyEmployee.  \r\nI am also trying to modify the name property of all of the entities with the date to prove I can update all the individual entities.\r\n\r\nInto the save, I am passing \r\n(1) Modified Parent Company\r\n--(1) Added ParentCompanyChildCompany \r\n----(1) Modified Child Company (same as in the ParentCompanyChildCompany)\r\n------(1) Added  ChildCompanyEmployee\r\n--------(1) Modified Employee  (same as in the ChildCompanyEmployee)\r\n\r\n_entities.UpdateGraph(parentCompany,\r\n                map => map.OwnedCollection(p => p.ParentCompanyChildCompanies));\r\n_entities.SaveChanges();\r\n**This modifies the parent company, and adds the ParentCompanyChildCompany, does not modify the child, employee etc.\r\n\r\n   _entities.UpdateGraph(parentCompany,\r\n                    map => map.OwnedCollection(p => p.ParentCompanyChildCompanies,\r\n                        with => with.OwnedEntity(p => p.ChildCompany,\r\n                        withChildren => withChildren.OwnedCollection(p => p.ChildCompanyEmployees,\r\n                        withEmployees => withEmployees.OwnedEntity(p => p.Employee)))));\r\n_entities.SaveChanges();\r\n**This modifies the parent company, and adds the ParentCompanyChildCompany, saves the child company and employee as new entities and reflects that in ParentCompanyChildCompany, and ChildCompanyEmployee.\r\n\r\n_entities.UpdateGraph(parentCompany,\r\n                    map => map.OwnedCollection(p => p.ParentCompanyChildCompanies,\r\n                        with => with.OwnedEntity(p => p.ChildCompany,\r\n                        withChildren => withChildren.OwnedCollection(p => p.ChildCompanyEmployees,\r\n                        withEmployees => withEmployees.AssociatedEntity(p => p.Employee)))));\r\n_entities.SaveChanges();\r\n**This modifies the parent company, and adds the ParentCompanyChildCompany, saves the child company as new entities and reflects that in ParentCompanyChildCompany, and ChildCompanyEmployee.  Employee is not modified and the proper entry for that employee is in ParentCompanyChildCompany.\r\n\r\nIs there any way to accomplish what I am looking for?\r\n"}}