Saved search queries

Jun 20, 2011 at 12:53 AM

When you perform a search query at List[entity]Subset.ascx, a IRelationPredicateBucket is sent to the List[entity]instances.ascx control. The idea is that you can grab such serialized IRelationPredicateBucket into a text file, or database, etc., and you then can pick it up again in the List[entity]Subset.ascx control.

The first thing to do when you write a template is design how the final result should look like. So, for Saved Search Queries this is the idea:



(if you think about a better name, please tell us)

This interface describe how a saved search query should behave. A code for this could be:

public interface IPredicateExpressionStorage
     List<IRelationPredicateBucket> GetSavedPredicates(EntityType t);
     bool SavePredicate(EntityType t, IRelationPredicateBucket filter);


Implement the interface

Initially, we could start with a FilePredicateExpressionStorage as this is more practical (you generate templates and compile the code). If we write a DatabasePredicateExpressionStorage, it could take a couple of steps to get it running. Eventually the user would decide. As a matter of fact, the user could write its own storage.


Say to the ListSubSet control what is our storage

The search control interface needs another property to set the used storage.


Write templates

These are very general templates. They don't need to know anything about the project, entities o fields. This could be a project on its own. The only thing is that we need to indicate to the GUI information file what is the implementation we would use. Doing this, the generator will set up the search controls so thy will use the corresponding storage.