I’ve been working on the object data context for the last two nights. It’s mostly just refactoring, but I ended up doing some re-engineering in a few places. It’s really important that the the framework objects do as much as possible, and implementations of the data contexts do as little work as possible. The result is a 2 step save process:
- The xml is deserialized into a graph of Graph Description objects. This maintains the relationships between the objects
- When it comes time to save each individual object, the Graph Description is simplified to just the property names and values which are passed to the object data context. The object data context only has to insert or update the exact values it received; no other work is needed.
That is about done. The only part left is the actual SQL part within the implementations; rewriting the inserts/updates.
Also, I’ve introduced object-type level rules. These are the rules that control the behavior when you save the graph. For example; if you’re saving a movie review where the author is JAY, you don’t have to save the author object. You only have to save the movie review and possibly update the reference to the author object. The name of that rule is “UpdateWhenNested”. It defaults to 1. In the case of author, we’ll change it to 0.
The rules are also going to be user aware. Different rules may apply to different users or different types of users. But, that’s a future task.
42 objects/interface and counting.