On an example of Role Management system, I have Users and Roles. A user can be assigned many roles and a role can contain many users. I retrieve a user, modify role list on the client side and then try to submit. When retrieving a user, I do detach User entity from the context, I also specify load options to load Role List, and then detach each role from the context. On the client I add Role entities to the User.RoleList collection, then Attach User entity to the context and SubmitChanges. But new roles are not added.
Is there a complete example that shows adding/removing to/from such lists and then submitting changes to the parent entity?
We do have some attach tests and a many to many unit test located in the Tracker Sample Application:code.google.com/.../detail
I believe when you do an attach, it doesn't attach child entities (RoleList). I took a look at the Table source code (via reflector) and there are various attach methods like AttachAll. You may need to also call Attach on the RoleList before calling submit changes.
CodeSmith Tools, LLC. Software Development Engineer
.NetTiers team | Visit http://www.nettiers.net
Yeah, I experimented with different types of Attachment and can't seem to make it work. It seems at this moment, that the only way to have RoleList update is from a separate method, not from User.Save().
If you could update the Tracker tests with a scenario that fails, I'd be more than happy to take a look into it.