NOODB: Property Drilling Works!

I got the property drilling working last night, but it was ugly and only worked under specific conditions. I had to take a step back and review all of the moving parts. It needed to be slapped around.

The logic of the QueryParser is motly unchanged, but the objects it populates have changed. The output is stored differently.

The SqlQueryConverter has been seriously overhauled.

The result is a much cleaner API. The output of the QueryParser needs to be easily consumable so that it can be converted to run against any repository. I’m very attentive to the public facing APIs. I write the SqlQueryConverter as if I know nothing about the innards of NOODB.

The final result is pretty cool. As I’ve been describing for days, I can now drill into the object graph for the where and the order by. This will later encompass the select as well.

Once everything was working, I went back to what started this to begin with. The DvdFriend page shows a list of recent reviews. You can click the AUTHOR link to see all of the reviews that author has written.

  1. Created the UserReview page
  2. Created an object data source that hits a new method (below)
  3. Created a grid view that binds to the object data source
  4. Tweaked the grid
  5. Updated the recent reviews to link to this new page
    public static Collection<MovieReview> GetUserMovieReviews(string userName)
        IObjectClient client = NoodbUtility.GetNoodbClient();
        return client.Query<MovieReview>("from r in MovieReview where r.Author.ScreenName=='" + userName + "' orderby r.ReviewDate descending");

That’s a pretty simple query. It just returns the movie reviews of a particular author.

The one I tested with is a little more complex.

@"from m in MovieReview 
                        m.Author.ScreenName == 'DvdFriend' 
                        || m.Author.ScreenName=='Chris' 
                        m.Author.ScreenName ascending, 
                        m.Movie.ProductName descending 
                  take 10"

I didn’t wimp out on the sql; it does the bare minimum number of joins to get what it needs. In this case, it needs Author.ScreenName 3 times, but the sql only gets it once. The easier/quicker way would’ve been to join to it 3 times, but then I’d feel just awful about myself.

The user review page was up and running in about 4 minutes, most of which was spent tweaking the grid.

  • Added Movie Title
  • Removed Review Id
  • Removed Review Text

Here’s a good example of where the view feature and/or projections will come in handy. First of all, the full review comes back in the object. I’m not displaying it, but it’s still coming back. It would be nice to exclude that.

Secondly, the grid is only showing 5 fields. Not only should we be able to specify that we only want those 5 fields, but we should also have the option to bring them back in a flat format rather than the full object hierarchy. That’s great in read-only scenarios.

If NOODB had a road map, tonight would be a significant benchmark. This is a really powerful feature.


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: