hydrologics/Oasis.Base — pull request #24 by johnmetta (2011-10-29 18:23:17+00:00)
Title: Cascading changes

I had to make some changes to the StateManager, because when we Attach an object that has associated objects that have been previously Added (like things from the repository) we get an exception on Commit. This is because the context can only accept changes when all objects are in the Added state if one object in a many to many is in the added state.

The way I've gotten around this, is by trying to commit, and if we get an UpdateException, we grab all of the objects that are either Unchanged or Modified, and we call the AddObject method on them- so they are added to the context in the Added state.

I need to do some deeper testing to see about what the unintended consequences of this might be if there are any, but initial testing seems to work.

@danrichardson, this should allow you to continue, but it wasn't causing the error you were seeing before, which was caused by the Attach method being used in a non-generic fashion as I mentioned already.