コード例 #1
0
ファイル: Filter.cs プロジェクト: takint/ff.words
        public Expression <Func <TEntity, bool> > BuildExpression(FilterRequest filterRequest, Dictionary <string, string> filterMaps)
        {
            // If no sortby field is supplied, use the default.
            if (filterRequest == null)
            {
                return(null);
            }

            var filter = new Builder.Filter <TEntity>();

            foreach (var filterDetail in filterRequest.Filters)
            {
                // For multi-values filter
                FilterStatementConnector connectLogic = filterRequest.Logic == "or" ? FilterStatementConnector.Or : FilterStatementConnector.And;
                if (filterDetail.Field == "Deleted")
                {
                    connectLogic = FilterStatementConnector.And;
                }

                filter.By(filterDetail.Field, this.OperationDictionary[filterDetail.Operator], filterDetail.Value, connectLogic);
            }

            return(filter.BuildExpression());
        }
コード例 #2
0
ファイル: Filter.cs プロジェクト: takint/ff.words
 public Filter(FilterRequest filterRequest, Dictionary <string, string> filterMaps = null)
 {
     Expression = BuildExpression(filterRequest, filterMaps);
 }