public static DbExpression Convert(DynamicFilterDefinition filter, DbExpressionBinding binding, ObjectContext objectContext)
        {
            var visitor    = new LambdaToDbExpressionVisitor(filter, binding, objectContext);
            var expression = visitor.Visit(filter.Predicate) as LambdaExpression;

            return(visitor.GetDbExpressionForExpression(expression.Body));
        }
        public DynamicFilterConvention(string filterName, Type entityType, LambdaExpression predicate,
                                        string columnName)
        {
            var configuration = Types().Where(entityType.IsAssignableFrom);
            configuration.Configure(ctc =>
            {
                var filterDefinition = new DynamicFilterDefinition(filterName, predicate, columnName, ctc.ClrType);

                ctc.HasTableAnnotation(filterDefinition.AttributeName, filterDefinition);
            });
        }
Exemple #3
0
        public DynamicFilterConvention(string filterName, Type entityType, LambdaExpression predicate,
                                       string columnName)
        {
            var configuration = Types().Where(entityType.IsAssignableFrom);

            configuration.Configure(ctc =>
            {
                var filterDefinition = new DynamicFilterDefinition(filterName, predicate, columnName, ctc.ClrType);

                ctc.HasTableAnnotation(filterDefinition.AttributeName, filterDefinition);
            });
        }
 private LambdaToDbExpressionVisitor(DynamicFilterDefinition filter, DbExpressionBinding binding, ObjectContext objectContext)
 {
     _filter        = filter;
     _binding       = binding;
     _objectContext = objectContext;
 }