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


C# ExpressionBuilder.BuildSequence方法代码示例

本文整理汇总了C#中ExpressionBuilder.BuildSequence方法的典型用法代码示例。如果您正苦于以下问题:C# ExpressionBuilder.BuildSequence方法的具体用法?C# ExpressionBuilder.BuildSequence怎么用?C# ExpressionBuilder.BuildSequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExpressionBuilder的用法示例。


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

示例1: BuildMethodCall

        protected override IBuildContext BuildMethodCall(ExpressionBuilder builder, MethodCallExpression methodCall, BuildInfo buildInfo)
        {
            var sequence = builder.BuildSequence(new BuildInfo(buildInfo, methodCall.Arguments[0]));
            var query    = builder.BuildSequence(new BuildInfo(buildInfo, methodCall.Arguments[1], new SqlQuery()));
            var except   = query.SqlQuery;

            sequence = new SubQueryContext(sequence);

            var sql = sequence.SqlQuery;

            except.ParentSql = sql;

            if (methodCall.Method.Name == "Except")
                sql.Where.Not.Exists(except);
            else
                sql.Where.Exists(except);

            var keys1 = sequence.ConvertToSql(null, 0, ConvertFlags.Key);
            var keys2 = query.   ConvertToSql(null, 0, ConvertFlags.Key);

            if (keys1.Length != keys2.Length)
                throw new InvalidOperationException();

            for (var i = 0; i < keys1.Length; i++)
            {
                except.Where
                    .Expr(keys1[i].Sql)
                    .Equal
                    .Expr(keys2[i].Sql);
            }

            return sequence;
        }
开发者ID:henleygao,项目名称:linq2db,代码行数:33,代码来源:IntersectBuilder.cs

示例2: BuildMethodCall

        protected override IBuildContext BuildMethodCall(ExpressionBuilder builder, MethodCallExpression methodCall, BuildInfo buildInfo)
        {
            var sequence = builder.BuildSequence(new BuildInfo(buildInfo, methodCall.Arguments[0]));

            if (sequence.SelectQuery.Select.TakeValue != null || sequence.SelectQuery.Select.SkipValue != null)
                sequence = new SubQueryContext(sequence);

            var lambda  = (LambdaExpression)methodCall.Arguments[1].Unwrap();
            var sparent = sequence.Parent;
            var order   = new ExpressionContext(buildInfo.Parent, sequence, lambda);
            var body    = lambda.Body.Unwrap();
            var sql     = builder.ConvertExpressions(order, body, ConvertFlags.Key);

            builder.ReplaceParent(order, sparent);

            if (!methodCall.Method.Name.StartsWith("Then"))
                sequence.SelectQuery.OrderBy.Items.Clear();

            foreach (var expr in sql)
            {
                var e = builder.ConvertSearchCondition(sequence, expr.Sql);
                sequence.SelectQuery.OrderBy.Expr(e, methodCall.Method.Name.EndsWith("Descending"));
            }

            return sequence;
        }
开发者ID:petedv,项目名称:linq2db,代码行数:26,代码来源:OrderByBuilder.cs

示例3: BuildMethodCall

        protected override IBuildContext BuildMethodCall(ExpressionBuilder builder, MethodCallExpression methodCall, BuildInfo buildInfo)
        {
            var sequence  = builder.BuildSequence(new BuildInfo(buildInfo, methodCall.Arguments[0]));
            var condition = (LambdaExpression)methodCall.Arguments[1].Unwrap();
            var result    = builder.BuildWhere(buildInfo.Parent, sequence, condition, true);

            result.SetAlias(condition.Parameters[0].Name);

            return result;
        }
开发者ID:pebezo,项目名称:linq2db,代码行数:10,代码来源:WhereBuilder.cs

示例4: BuildMethodCall

        protected override IBuildContext BuildMethodCall(ExpressionBuilder builder, MethodCallExpression methodCall, BuildInfo buildInfo)
        {
            var sequence = builder.BuildSequence(new BuildInfo(buildInfo, methodCall.Arguments[0]));
            var sql      = sequence.SqlQuery;

            if (sql.Select.TakeValue != null || sql.Select.SkipValue != null)
                sequence = new SubQueryContext(sequence);

            sequence.SqlQuery.Select.IsDistinct = true;
            sequence.ConvertToIndex(null, 0, ConvertFlags.All);

            return sequence;
        }
开发者ID:henleygao,项目名称:linq2db,代码行数:13,代码来源:DistinctBuilder.cs

示例5: BuildMethodCall

        protected override IBuildContext BuildMethodCall(ExpressionBuilder builder, MethodCallExpression methodCall, BuildInfo buildInfo)
        {
            var sequence = builder.BuildSequence(new BuildInfo(buildInfo, methodCall.Arguments[0]));

            var table    = (TableBuilder.TableContext)sequence;
            var selector = (LambdaExpression)methodCall.Arguments[1].Unwrap();

            if (table.SqlTable.LoadWith == null)
                table.SqlTable.LoadWith = new List<MemberInfo[]>();

            table.SqlTable.LoadWith.Add(GetAssosiations(builder, selector.Body.Unwrap()).ToArray());

            return sequence;
        }
开发者ID:nectide,项目名称:linq2db,代码行数:14,代码来源:LoadWithBuilder.cs

示例6: BuildMethodCall

		protected override IBuildContext BuildMethodCall(ExpressionBuilder builder, MethodCallExpression methodCall, BuildInfo buildInfo)
		{
			var sequence = builder.BuildSequence(new BuildInfo(buildInfo, methodCall.Arguments[0]));
			var table    = (TableBuilder.TableContext)sequence;
			var value    = (string)((ConstantExpression)methodCall.Arguments[1]).Value;

			switch (methodCall.Method.Name)
			{
				case "TableName"    : table.SqlTable.PhysicalName = value; break;
				case "DatabaseName" : table.SqlTable.Database     = value; break;
				case "OwnerName"    : table.SqlTable.Owner        = value; break;
			}

			return sequence;
		}
开发者ID:jack128,项目名称:linq2db,代码行数:15,代码来源:TableAttributeBuilder.cs

示例7: BuildMethodCall

		protected override IBuildContext BuildMethodCall(ExpressionBuilder builder, MethodCallExpression methodCall, BuildInfo buildInfo)
		{
			var sequence = builder.BuildSequence(new BuildInfo(buildInfo, methodCall.Arguments[0]));
			var table    = (TableBuilder.TableContext)sequence;
			var value    = (string)((ConstantExpression)methodCall.Arguments[1]).Value;

			table.SqlTable.SqlTableType   = SqlTableType.Expression;
			table.SqlTable.TableArguments = new ISqlExpression[0];

			switch (methodCall.Method.Name)
			{
				case "With"                : table.SqlTable.Name = "{{0}} {{1}} WITH ({0})".Args(value); break;
				case "WithTableExpression" : table.SqlTable.Name = value;                                break;
			}

			return sequence;
		}
开发者ID:donners77,项目名称:linq2db,代码行数:17,代码来源:WithTableExpressionBuilder.cs

示例8: BuildMethodCall

        protected override IBuildContext BuildMethodCall(ExpressionBuilder builder, MethodCallExpression methodCall, BuildInfo buildInfo)
        {
            var sequence     = builder.BuildSequence(new BuildInfo(buildInfo, methodCall.Arguments[0]));
            var defaultValue = methodCall.Arguments.Count == 1 ? null : methodCall.Arguments[1].Unwrap();

            if (buildInfo.Parent is SelectManyBuilder.SelectManyContext)
            {
                var groupJoin = ((SelectManyBuilder.SelectManyContext)buildInfo.Parent).Sequence[0] as JoinBuilder.GroupJoinContext;

                if (groupJoin != null)
                {
                    groupJoin.SelectQuery.From.Tables[0].Joins[0].JoinType = SelectQuery.JoinType.Left;
                    groupJoin.SelectQuery.From.Tables[0].Joins[0].IsWeak   = false;
                }
            }

            return new DefaultIfEmptyContext(buildInfo.Parent, sequence, defaultValue);
        }
开发者ID:jack128,项目名称:linq2db,代码行数:18,代码来源:DefaultIfEmptyBuilder.cs

示例9: BuildMethodCall

        protected override IBuildContext BuildMethodCall(ExpressionBuilder builder, MethodCallExpression methodCall, BuildInfo buildInfo)
        {
            var sequence = builder.BuildSequence(new BuildInfo(buildInfo, methodCall.Arguments[0]));

            var arg = methodCall.Arguments[1].Unwrap();

            if (arg.NodeType == ExpressionType.Lambda)
                arg = ((LambdaExpression)arg).Body.Unwrap();

            var expr = builder.ConvertToSql(sequence, arg);

            if (methodCall.Method.Name == "Take")
            {
                BuildTake(builder, sequence, expr);
            }
            else
            {
                BuildSkip(builder, sequence, sequence.SqlQuery.Select.SkipValue, expr);
            }

            return sequence;
        }
开发者ID:henleygao,项目名称:linq2db,代码行数:22,代码来源:TakeSkipBuilder.cs

示例10: BuildMethodCall

		protected override IBuildContext BuildMethodCall(ExpressionBuilder builder, MethodCallExpression methodCall, BuildInfo buildInfo)
		{
			return builder.BuildSequence(new BuildInfo(buildInfo, methodCall.Arguments[0]));
		}
开发者ID:Convey-Compliance,项目名称:linq2db,代码行数:4,代码来源:PassThroughBuilder.cs


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