Query<T> added to WilsonORWrapper

I just updated WilsonORWrapper to include a Query<T> class that simplifies using OPathQuery<T> objects. To illustrate, I’ll take the content from the newly-written Services page on the project wiki (which also gives an overview of the Data<T> service).


The Query service provides a simple interface to generating OPath queries. It helps simplify code by avoiding the need to explicitly use the Wilson.ORMapper namespace to generate OPathQuery objects.

Using the Query service is best illustrated by comparing how you would generate an OPathQuery using the Wilson.ORMapper namespace, and how you would generate a query using the Query object (which hides the underlying OPathQuery object from your code).

Querying using OPathQuery<T>


using Wilson.ORMapper;
using WilsonORWrapper.Services;
...
OPathQuery&lt;User&gt; query = new OPathQuery&lt;User&gt;("Name = ?");
User user = Data&lt;User&gt;.Retrieve(query, "Brian"); 

Querying using Query<T>


using WilsonORWrapper.Services;
...
Query&lt;User&gt; query = new Query&lt;User&gt;("Name = ?");
User user = Data&lt;User&gt;.Retrieve(query, "Brian"); 

Note the similarities of the code. The usage of Query<T> is the same as OPathQuery<T>, but you are saved the hassle of dealing with a separate namespace.


I hope you find this helpful, and as always, please give me your feedback on the project.

Download the source code for this release (r41). (Compiled distributions are not currently available.)

Bookmark and Share

Popularity: 20% [?]

Related Posts

What matters is what you make of yourself. I think that's what we should tell kids. Their job isn't to get good grades so they can get into a good college, but to learn and do. And not just because that's more rewarding than worldly success. That will increasingly be the route to worldly success.

-- Paul Graham

Comments 2

  1. wayde wrote:

    Brian,

    I created a ticket on the project site detailing several recommendations I think would be good for the framework. Personally, I’ve already made these changes to version r41. I put the file changes in a zip file.

    Anyways, when you have a chance … lmk what you think and if you have any questions.

    - wayde

    Posted 14 Jun 2007 at 4:14 am
  2. brian wrote:

    Great contributions — check out my comments at http://www.hosted-projects.com/trac/computersims/wilsonorwrapper/ticket/3#comment:1

    Posted 14 Jun 2007 at 9:22 am

Post a Comment

Your email is never published nor shared. Required fields are marked *