当前位置: 首页>>代码示例>>C#>>正文


C# DbFilterExpression类代码示例

本文整理汇总了C#中DbFilterExpression的典型用法代码示例。如果您正苦于以下问题:C# DbFilterExpression类的具体用法?C# DbFilterExpression怎么用?C# DbFilterExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DbFilterExpression类属于命名空间,在下文中一共展示了DbFilterExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Visit

 public override SqlFragment Visit(DbFilterExpression expression)
 {
     SelectStatement select = VisitInputExpressionEnsureSelect(expression.Input.Expression, 
         expression.Input.VariableName, expression.Input.VariableType);
     select = WrapIfNotCompatible(select, expression.ExpressionKind);
     select.Where = expression.Predicate.Accept(this);
     return select;
 }
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:8,代码来源:SelectGenerator.cs

示例2: Visit

        public override Expression Visit(DbFilterExpression expression)
        {
            Expression source = this.Visit(expression.Input.Expression);
            Type elementType = TypeHelper.GetElementType(source.Type);

            ParameterExpression param = Expression.Parameter(elementType, expression.Input.VariableName);

            using (this.CreateVariable(param, expression.Input.VariableName))
            {
                Expression predicate = this.Visit(expression.Predicate);
                LambdaExpression predicateLambda = Expression.Lambda(predicate, param);

                return queryMethodExpressionBuilder.Where(source, predicateLambda);
            }
        }
开发者ID:nozerowu,项目名称:ABP,代码行数:15,代码来源:TransformVisitor.Filter.cs

示例3: Visit

 /// <summary>
 /// This method called before the one below it when a filtering is already exists in the query (e.g. fetch an entity by id)
 /// so we apply the dynamic filtering at this level
 /// </summary>
 public override DbExpression Visit(DbFilterExpression expression)
 {
     var column = TenantAwareAttribute.GetTenantColumnName(expression.Input.Variable.ResultType.EdmType);
     if (!_injectedDynamicFilter && !string.IsNullOrEmpty(column))
     {
         var newFilterExpression = BuildFilterExpression(expression.Input, expression.Predicate, column);
         if (newFilterExpression != null)
         {
             //  If not null, a new DbFilterExpression has been created with our dynamic filters.
             return base.Visit(newFilterExpression);
         }
         
     }
     return base.Visit(expression);
 }
开发者ID:JensKlambauer,项目名称:EfMultitenant,代码行数:19,代码来源:TenantQueryVisitor.cs

示例4: Visit

        public override DbExpression Visit(DbFilterExpression expression)
        {
            //  If the query contains it's own filter condition (in a .Where() for example), this will be called
            //  before Visit(DbScanExpression).  And it will contain the Predicate specified in that filter.
            //  Need to inject our dynamic filters here and then 'and' the Predicate.  This is necessary so that
            //  the expressions are properly ()'d.
            //  It also allows us to attach our dynamic filter into the same DbExpressionBinding so it will avoid
            //  creating a new sub-query in MS SQL Server.

            string entityName = expression.Input.Variable.ResultType.EdmType.Name;
            var containers = _ObjectContext.MetadataWorkspace.GetItems<EntityContainer>(DataSpace.SSpace).First();
            var filterList = FindFiltersForEntitySet(expression.Input.Variable.ResultType.EdmType.MetadataProperties, containers);

            var newFilterExpression = BuildFilterExpressionWithDynamicFilters(entityName, filterList, expression.Input, expression.Predicate);
            if (newFilterExpression != null)
            {
                //  If not null, a new DbFilterExpression has been created with our dynamic filters.
                return newFilterExpression;
            }

            return base.Visit(expression);
        }
开发者ID:nozerowu,项目名称:ABP,代码行数:22,代码来源:DynamicFilterQueryVisitor.cs

示例5: Visit

        public override DbExpression Visit(DbFilterExpression expression)
        {
            //  If the query contains it's own filter condition (in a .Where() for example), this will be called
            //  before Visit(DbScanExpression).  And it will contain the Predicate specified in that filter.
            //  Need to inject our dynamic filters here and then 'and' the Predicate.  This is necessary so that
            //  the expressions are properly ()'d.
            //  It also allows us to attach our dynamic filter into the same DbExpressionBinding so it will avoid
            //  creating a new sub-query in MS SQL Server.

            string entityName = expression.Input.Variable.ResultType.EdmType.Name;
            var filterList = expression.Input.Variable.ResultType.EdmType.MetadataProperties
                                .Where(mp => mp.Name.Contains("customannotation:" + DynamicFilterConstants.AttributeNamePrefix))
                                .Select(m => m.Value as DynamicFilterDefinition);

            var newFilterExpression = BuildFilterExpressionWithDynamicFilters(entityName, filterList, expression.Input, expression.Predicate);
            if (newFilterExpression != null)
            {
                //  If not null, a new DbFilterExpression has been created with our dynamic filters.
                return newFilterExpression;
            }

            return base.Visit(expression);
        }
开发者ID:calebjenkins,项目名称:Highway.Data,代码行数:23,代码来源:DynamicFilterQueryVisitor.cs

示例6: Visit

            // For Distinct, Limit, OfType there is no need to override the base visitor behavior.

            public override DbExpression Visit(DbFilterExpression expression)
            {
                Check.NotNull(expression, "expression");

                // Only consider the Filter input
                var found = Find(expression.Input.Expression);
                if (!ReferenceEquals(found, expression.Input.Expression))
                {
                    return found.BindAs(expression.Input.VariableName).Filter(expression.Predicate);
                }
                else
                {
                    return expression;
                }
            }
开发者ID:christiandpena,项目名称:entityframework,代码行数:17,代码来源:ObjectSpanRewriter.cs

示例7: Visit

 public override void Visit(DbFilterExpression e)
 {
     VisitExprKind(e.ExpressionKind);
     _key.Append('(');
     VisitBinding(e.Input);
     _key.Append('(');
     e.Predicate.Accept(this);
     _key.Append("))");
 }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:9,代码来源:ExpressionKeyGen.cs

示例8: Filter

 internal override DbExpression Filter(DbFilterExpression filter)
 {
     return filter;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:4,代码来源:OrderByLifter.cs

示例9: Visit

 public override void Visit(DbFilterExpression e)
 {
     Begin(e);
     Dump(e.Input, "Input");
     Dump(e.Predicate, "Predicate");
     End(e);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:ExpressionDumper.cs

示例10: Visit

 public override void Visit(DbFilterExpression expression) { }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:1,代码来源:DbExpressionVisitorTests.cs

示例11: Visit

 public override DbExpression Visit(DbFilterExpression expression)
 {
     System.Diagnostics.Debug.Print("Visit(DbFilterExpression): {0}", expression);
     return base.Visit(expression);
 }
开发者ID:jcachat,项目名称:EntityFramework.DynamicFilters,代码行数:5,代码来源:DynamicFilterQueryVisitorCSpace.cs

示例12: Visit

        /// <summary>
        ///     Visitor pattern method for <see cref="DbFilterExpression" />.
        /// </summary>
        /// <param name="expression"> The DbFilterExpression that is being visited. </param>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="expression" />
        ///     is null
        /// </exception>
        public override void Visit(DbFilterExpression expression)
        {
            Check.NotNull(expression, "expression");

            VisitExpressionBindingPre(expression.Input);
            VisitExpression(expression.Predicate);
            VisitExpressionBindingPost(expression.Input);
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:16,代码来源:BasicExpressionVisitor.cs

示例13: Visit

        /// <summary>
        /// Implements the visitor pattern for <see cref="T:System.Data.Common.CommandTrees.DbFilterExpression"/>.
        /// </summary>
        /// <param name="expression">The <see cref="T:System.Data.Common.CommandTrees.DbFilterExpression"/> that is visited.</param>
        public override void Visit(DbFilterExpression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            expression.Input.Expression.Accept(this);
            expression.Predicate.Accept(this);
        }
开发者ID:raovat,项目名称:develop,代码行数:14,代码来源:DbCommandTreeScanner.cs

示例14: Visit

 public override void Visit(DbFilterExpression expression)
 {
     Contract.Requires(expression != null);
 }
开发者ID:junxy,项目名称:entityframework,代码行数:4,代码来源:DbExpressionVisitor.cs

示例15: Visit

 // For Distinct, Limit, OfType there is no need to override the base visitor behavior.
 
 public override DbExpression Visit(DbFilterExpression expression)
 {
     // Only consider the Filter input
     DbExpression found = Find(expression.Input.Expression);
     if(!object.ReferenceEquals(found, expression.Input.Expression))
     {
         return found.BindAs(expression.Input.VariableName).Filter(expression.Predicate);
     }
     else
     {
         return expression;
     }
 }
开发者ID:uQr,项目名称:referencesource,代码行数:15,代码来源:ObjectSpanRewriter.cs


注:本文中的DbFilterExpression类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。