/// <summary> /// Create a local parameter in commom case (a plain value) /// </summary> /// <param name="documentSearch">Document search engine</param> /// <param name="conditional">Conditional to add parameter</param> /// <param name="name">Name of parameter</param> /// <param name="value">Plain value to include in query</param> /// <returns>Document search engine</returns> public static DocumentSearch <TDocument> LocalParameterIf <TDocument>(this DocumentSearch <TDocument> documentSearch, Func <bool> conditional, string name, string value) where TDocument : Document { Checker.IsNull(conditional); if (conditional.Invoke()) { documentSearch.LocalParameter(name, value); } return(documentSearch); }
/// <summary> /// Create a local parameter in commom case (a simple query) /// </summary> /// <param name="documentSearch">Document search engine</param> /// <param name="conditional">Conditional to add parameter</param> /// <param name="name">Name of parameter</param> /// <param name="fieldExpression">Expression used to find field name</param> /// <param name="query">Query used to make filter</param> /// <returns>Document search engine</returns> public static DocumentSearch <TDocument> LocalParameterIf <TDocument>(this DocumentSearch <TDocument> documentSearch, Func <bool> conditional, string name, Expression <Func <TDocument, object> > fieldExpression, Action <SearchQuery <TDocument> > query) where TDocument : Document { Checker.IsNull(conditional); if (conditional.Invoke()) { documentSearch.LocalParameter(name, fieldExpression, query); } return(documentSearch); }