NOODB: Update


I’ve been working on 3 things

Complex Graphs

Once I started to build and test against more complex graphs, I realized the type registration was only working 100% for the type being saved, not all of the related types.

I had a complex solution at first, then I rewrote it with a simpler version, and the simpler version is the one that I found the problems with.

I ended up rewriting it two times in order to get it right. Now, the type registration builder properly parses the entire graph.

Heavy Admin Data Context

The admin data context is responsible for things like registering types. It was doing too much work. I’d simply pass it a registration object and say “save this”. It would have to work out all of the details and associations, etc.

All of that work has been moved to the server. The server contains all of the logic. All the admin data context has, as it should, is simple operations. “Create This Object Type”, “Create This Property For This Object”. It doesn’t have to resolve Ids on it’s own, or figure out if it’s an insert or update, etc. It just does what it’s told.

This is much cleaner. Now, new database contexts can be introduced very easily.

Simple / Complex Types

I was originally differentiating between simple types and complex types. Simple types are things like string, primitives and guid. The problem there is that there are probably tons more. It’s a high-maintenance branch point, so I eliminated the branch as much as possible.

This is a work in progress. It no longer needs to know if it’s simple or complex when saving the type information. But, it needs to figure it out to save the value. (Simple values are stored in columns; if it’s complex, it references another object.

Passing Tests

I have a test that builds up a couple objects, then saves it a bunch of times, swapping out the ids on each iterations. There are interfaces, base classes, etc. Since it now fully parses the graph, you get everything.

                Assert.AreEqual(Iterations, client.GetObjects<BookReview>().Count);
                Assert.AreEqual(Iterations, client.GetObjects<IBookReview>().Count);
                Assert.AreEqual(Iterations, client.GetObjects<MovieReview>().Count);
                Assert.AreEqual(Iterations * 2, client.GetObjects<Review>().Count);
                Assert.AreEqual(Iterations * 3, client.GetObjects<IDisposable>().Count);
                Assert.AreEqual(Iterations, client.GetObjects<ICloneable>().Count);
                Assert.AreEqual(Iterations * 3, client.GetObjects<Rating>().Count);
                Assert.AreEqual(Iterations * 3, client.GetObjects<IRating>().Count);

It’s not working for primitives yet.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: