Query 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.)

0 thoughts on “Query<T> added to WilsonORWrapper

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.