/// <summary> /// analyze the criteria properties expression for the entity /// </summary> /// <param name="entity"></param> /// <returns></returns> private bool AnalyzeEntityOnCriteria(SearchEntity searchEntity, Entity entity, SearchEntityResult result) { // create a work/exec object of the criteria expression SearchPropBaseWork searchPropBaseWork = CreateAllSearchPropBaseWork(searchEntity.SearchPropRoot); // a bool expr, go inside left and right part SearchPropBoolExprWork searchPropBoolExprWork = searchPropBaseWork as SearchPropBoolExprWork; if (searchPropBoolExprWork != null) { // create work object on the left side // create work object on the right side //return searchPropBoolExprWork; // ok, no error return(true); } // a final criterion SearchPropCriterionKeyTextWork propCritKeyTextWork = searchPropBaseWork as SearchPropCriterionKeyTextWork; if (propCritKeyTextWork != null) { EntitySearcherPropKeyText searcherPropKeyText = new EntitySearcherPropKeyText(_reposit); return(searcherPropKeyText.AnalyzeEntityOnCritKeyText(propCritKeyTextWork, entity, result)); } // TODO: others final criterion type // not implemented throw new Exception("Search property not yet implemented!"); }
/// <summary> /// Create all work objet matching object, recursivly. /// </summary> /// <param name="searchPropBase"></param> /// <returns></returns> private SearchPropBaseWork CreateAllSearchPropBaseWork(SearchPropBase searchPropBase) { // a bool expr, go inside left and right part SearchPropBoolExpr searchPropBoolExpr = searchPropBase as SearchPropBoolExpr; if (searchPropBoolExpr != null) { SearchPropBoolExprWork searchPropBoolExprWork = new SearchPropBoolExprWork(); searchPropBoolExprWork.SearchPropBaseId = searchPropBoolExpr.Id; searchPropBoolExprWork.Operator = searchPropBoolExpr.Operator; // create work object on the left side searchPropBoolExprWork.LeftOperand = CreateAllSearchPropBaseWork(searchPropBoolExpr.LeftOperand); // create work object on the right side searchPropBoolExprWork.RightOperand = CreateAllSearchPropBaseWork(searchPropBoolExpr.RightOperand); return(searchPropBoolExprWork); } // a final criterion SearchPropCriterionKeyText propCritKeyText = searchPropBase as SearchPropCriterionKeyText; if (propCritKeyText != null) { SearchPropCriterionKeyTextWork propCritKeyTextWork = new SearchPropCriterionKeyTextWork(); propCritKeyTextWork.SearchPropBaseId = propCritKeyText.Id; propCritKeyTextWork.KeyText = propCritKeyText.KeyText; propCritKeyTextWork.PropChildsScan = propCritKeyText.PropChildsScan; propCritKeyTextWork.PropKeyTextType = propCritKeyText.PropKeyTextType; propCritKeyTextWork.TextMatch = propCritKeyText.TextMatch; propCritKeyTextWork.TextSensitive = propCritKeyText.TextSensitive; return(propCritKeyTextWork); } // TODO: others final criterion type // not implemented throw new Exception("Search property not yet implemented!"); }