I have a N-layered application, where I use Specification pattern. Now, I want to provide some ways to construct specifications to client code. It must be several pre-defined options, like these:
- Equal
- GreaterThan
- Contains
These objects (let me call them Filters) mustn't contain any logic (methods), only data - filter type and parameters. And there must be natural way to transform them into specification at server. Here's example of how it should look from the client side:
var serviceClient = new DataModuleService();
var equalFilter = new ContainsFilter<Book>("Title","Lord of the Rings");
var lordOfTheRingBooks = serviceClient.GetBooks(equalFilter);
There also must be filter types for all standard operations (like Equal, Greater, In, Between, StartsWith for string, etc) and ways to combine them with Boolean operators (and, or, not).
Is there some patterns/standard practices to implement such a thing?
UPD: the task is frozen for now, and I've started to think that there is problem in task's definition itself.