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<User> query = new OPathQuery<User>("Name = ?"); User user = Data<User>.Retrieve(query, "Brian");
Querying using Query<T>
using WilsonORWrapper.Services; ... Query<User> query = new Query<User>("Name = ?"); User user = Data<User>.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.)