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


C# Linq.QueryModel类代码示例

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


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

示例1: ExtractQueryAnnotations

        private static void ExtractQueryAnnotations(
            QueryModel queryModel, ICollection<IQueryAnnotation> queryAnnotations)
        {
            queryModel.MainFromClause
                .TransformExpressions(e =>
                    ExtractQueryAnnotations(e, queryAnnotations));

            foreach (var bodyClause in queryModel.BodyClauses)
            {
                bodyClause
                    .TransformExpressions(e =>
                        ExtractQueryAnnotations(e, queryAnnotations));
            }

            foreach (var resultOperator in queryModel.ResultOperators.ToList())
            {
                var queryAnnotation = resultOperator as IQueryAnnotation;

                if (queryAnnotation != null)
                {
                    queryAnnotations.Add(queryAnnotation);

                    queryAnnotation.QueryModel = queryModel;

                    if (queryAnnotation.QuerySource == null)
                    {
                        queryAnnotation.QuerySource = queryModel.MainFromClause;
                    }

                    queryModel.ResultOperators.Remove(resultOperator);
                }
            }
        }
开发者ID:RickyLin,项目名称:EntityFramework,代码行数:33,代码来源:QueryAnnotationExtractor.cs

示例2: VisitOrderByClause

        public virtual void VisitOrderByClause(OrderByClause orderByClause, QueryModel queryModel, int index)
        {
            ArgumentUtility.CheckNotNull ("orderByClause", orderByClause);
              ArgumentUtility.CheckNotNull ("queryModel", queryModel);

              VisitOrderings (orderByClause.Orderings, queryModel, orderByClause);
        }
开发者ID:nicocrm,项目名称:DotNetSDataClient,代码行数:7,代码来源:QueryModelVisitorBase.cs

示例3: VisitQueryModel

		public override void VisitQueryModel(QueryModel queryModel)
		{
			queryModel.MainFromClause.Accept(this, queryModel);
			VisitBodyClauses(queryModel.BodyClauses, queryModel);
			VisitResultOperators(queryModel.ResultOperators, queryModel);
			queryModel.SelectClause.Accept(this, queryModel);
		}
开发者ID:dstimac,项目名称:revenj,代码行数:7,代码来源:SqlGeneratorQueryModelVisitor.cs

示例4: VisitAdditionalFromClause

        public virtual void VisitAdditionalFromClause(AdditionalFromClause fromClause, QueryModel queryModel, int index)
        {
            ArgumentUtility.CheckNotNull ("fromClause", fromClause);
              ArgumentUtility.CheckNotNull ("queryModel", queryModel);

              // nothing to do here
        }
开发者ID:nicocrm,项目名称:DotNetSDataClient,代码行数:7,代码来源:QueryModelVisitorBase.cs

示例5: VisitJoinClause

        public virtual void VisitJoinClause(JoinClause joinClause, QueryModel queryModel, int index)
        {
            ArgumentUtility.CheckNotNull ("joinClause", joinClause);
              ArgumentUtility.CheckNotNull ("queryModel", queryModel);

              // nothing to do here
        }
开发者ID:nicocrm,项目名称:DotNetSDataClient,代码行数:7,代码来源:QueryModelVisitorBase.cs

示例6: ExtractQueryAnnotations

        private static void ExtractQueryAnnotations(
            QueryModel queryModel, ICollection<QueryAnnotationBase> queryAnnotations)
        {
            foreach (var resultOperator
                in queryModel.ResultOperators
                    .OfType<QueryAnnotationResultOperator>()
                    .ToList())
            {
                resultOperator.Annotation.QueryModel = queryModel;

                var includeAnnotation = resultOperator.Annotation as IncludeQueryAnnotation;
                resultOperator.Annotation.QuerySource = includeAnnotation != null
                    ? ExtractSourceReferenceExpression(includeAnnotation.NavigationPropertyPath).ReferencedQuerySource
                    : queryModel.MainFromClause;

                queryAnnotations.Add(resultOperator.Annotation);
                queryModel.ResultOperators.Remove(resultOperator);
            }

            queryModel.MainFromClause
                .TransformExpressions(e =>
                    ExtractQueryAnnotations(e, queryAnnotations));

            foreach (var bodyClause in queryModel.BodyClauses)
            {
                bodyClause
                    .TransformExpressions(e =>
                        ExtractQueryAnnotations(e, queryAnnotations));
            }
        }
开发者ID:491134648,项目名称:EntityFramework,代码行数:30,代码来源:QueryAnnotationExtractor.cs

示例7: SimpleArrayContains

        public static IWhereFragment SimpleArrayContains(ISerializer serializer, QueryModel queryModel, ContainsResultOperator contains)
        {
            var from = queryModel.MainFromClause.FromExpression;
            var visitor = new FindMembers();
            visitor.Visit(from);

            var members = visitor.Members;

            var constant = contains.Item as ConstantExpression;

            if (constant != null)
            {
                var array = Array.CreateInstance(constant.Type, 1);
                array.SetValue(constant.Value, 0);

                var dict = new Dictionary<string, object>();
                dict.Add(members.Last().Name, array);

                members.Reverse().Skip(1).Each(m =>
                {
                    dict = new Dictionary<string, object>() { {m.Name, dict} };
                });

                return new ContainmentWhereFragment(serializer, dict);
            }

            throw new NotSupportedException();
        }
开发者ID:bojanv91,项目名称:Marten,代码行数:28,代码来源:ContainmentWhereFragment.cs

示例8: ExtractQueryAnnotations

        private static void ExtractQueryAnnotations(
            QueryModel queryModel, ICollection<QueryAnnotationBase> queryAnnotations)
        {
            foreach (var resultOperator
                in queryModel.ResultOperators
                    .OfType<QueryAnnotationResultOperator>()
                    .ToList())
            {
                resultOperator.Annotation.QueryModel = queryModel;
                resultOperator.Annotation.QuerySource = queryModel.MainFromClause;
                queryAnnotations.Add(resultOperator.Annotation);
                queryModel.ResultOperators.Remove(resultOperator);
            }

            queryModel.MainFromClause
                .TransformExpressions(e =>
                    ExtractQueryAnnotations(e, queryAnnotations));

            foreach (var bodyClause in queryModel.BodyClauses)
            {
                bodyClause
                    .TransformExpressions(e =>
                        ExtractQueryAnnotations(e, queryAnnotations));
            }
        }
开发者ID:rbenhassine2,项目名称:EntityFramework,代码行数:25,代码来源:QueryAnnotationExtractor.cs

示例9: VisitWhereClause

 public override void VisitWhereClause(WhereClause whereClause, QueryModel queryModel, int index)
 {
     WhereJoinDetector.Find(whereClause.Predicate,_nameGenerator,
                                       this,
                                       _joins,
                                       _expressionMap);
 }
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:7,代码来源:AddJoinsReWriter.cs

示例10: ProcessResultOperator

        /// <summary>
        /// Implement the skipping. We have a main limitation: we currently know only how to implement integer skipping.
        /// We implement with "if" statements to support composability, even if it means running longer in the end...
        /// We actually return nothing when goes - we aren't really a final result the way "Count" is.
        /// </summary>
        /// <param name="resultOperator"></param>
        /// <param name="queryModel"></param>
        /// <param name="_codeEnv"></param>
        /// <returns></returns>
        public void ProcessResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, IGeneratedQueryCode codeEnv, ICodeContext codeContext, CompositionContainer container)
        {
            ///
            /// Quick checks to make sure
            /// 

            if (codeEnv == null)
                throw new ArgumentNullException("codeEnv cannot be null");

            var take = resultOperator as TakeResultOperator;
            var skip = resultOperator as SkipResultOperator;

            if (take == null && skip == null)
            {
                throw new ArgumentNullException("resultOperator must not be null and must represent either a take or a skip operation!");
            }

            if (take != null && take.Count.Type != typeof(int))
                throw new ArgumentException("Take operator count must be an integer!");
            if (skip != null && skip.Count.Type != typeof(int))
                throw new ArgumentException("Skip operator count must be an integer!");

            // If this is a "global" take, then we need to declare the variable a bit specially.
            // Global: we have a limit on the number of objects that goes across events. We test this by seeing if this
            // is a sub-query that is registered (or not).
            var isGlobalTake = codeContext.IsInTopLevelQueryModel(queryModel);

            // Now, we create a count variable and that is how we will tell if we are still skipping or
            // taking. It must be declared in the current block, before our current code! :-)

            var counter = DeclarableParameter.CreateDeclarableParameterExpression(typeof(int), otherDependencies: codeContext.LoopIndexVariable.Return<IDeclaredParameter>());
            if (isGlobalTake)
            {
                counter.DeclareAsStatic = true;
                codeEnv.Add(counter);
            } else
            {
                codeEnv.AddOutsideLoop(counter);
            }

            var comparison = StatementIfOnCount.ComparisonOperator.LessThanEqual;
            IValue limit = null;
            if (skip != null)
            {
                comparison = StatementIfOnCount.ComparisonOperator.GreaterThan;
                limit = ExpressionToCPP.GetExpression(skip.Count, codeEnv, codeContext, container);
            }
            else
            {
                limit = ExpressionToCPP.GetExpression(take.Count, codeEnv, codeContext, container);
            }

            codeEnv.Add(new StatementIfOnCount(counter, limit, comparison));

            ///
            /// We are particularly fortunate here. We don't have to update the Loop variable - whatever it is, is
            /// still the right one! Normally we'd have to futz with the LoopVariable in code context because we
            /// were iterating over something new. :-) Easy!
            /// 
        }
开发者ID:gordonwatts,项目名称:LINQtoROOT,代码行数:69,代码来源:ROTakeSkipOperators.cs

示例11: TransformQueryModel

        public static void TransformQueryModel(QueryModel queryModel)
        {
            var instance = new QueryModelTransformer();

            queryModel.Accept(instance);

        }
开发者ID:TheHunter,项目名称:Lucene.Net.Linq,代码行数:7,代码来源:QueryModelTransformer.cs

示例12: FlattenSubQuery

 protected override void FlattenSubQuery(SubQueryExpression subQueryExpression, FromClauseBase fromClause, QueryModel queryModel,
     int destinationIndex)
 {
     var subQueryModel = subQueryExpression.QueryModel;
     MoveResultOperatorsToParent(queryModel, subQueryModel);
     base.FlattenSubQuery(subQueryExpression, fromClause, queryModel, destinationIndex);
 }
开发者ID:Zaixu,项目名称:Lucene.Net.Linq,代码行数:7,代码来源:AggressiveSubQueryFromClauseFlattener.cs

示例13: Generate

        public static AdvancedSearchCriteria Generate(QueryModel model, IEktronIdProvider idProvider)
        {
            TransformationVisitor.Transform(model);
            AdvancedSearchCriteria criteria = TranslationVisitor.Translate(model, idProvider);

            return criteria;
        }
开发者ID:benjaminramey,项目名称:GoodlyFere.Ektron.Linq,代码行数:7,代码来源:CriteriaGenerator.cs

示例14: ApplyNodeSpecificSemantics

        protected override QueryModel ApplyNodeSpecificSemantics(QueryModel queryModel,
            ClauseGenerationContext clauseGenerationContext)
        {
            queryModel.BodyClauses.Add(new UseKeysClause(Keys));

            return queryModel;
        }
开发者ID:amccool,项目名称:Linq2Couchbase,代码行数:7,代码来源:UseKeysExpressionNode.cs

示例15: FlattenSubQuery

        private void FlattenSubQuery(SubQueryExpression subQueryExpression, FromClauseBase fromClause,
		                             QueryModel queryModel)
        {
            // Move the result operator up
            if (queryModel.ResultOperators.Count != 0)
            {
                throw new NotImplementedException();
            }

            var groupBy = (GroupResultOperator) subQueryExpression.QueryModel.ResultOperators[0];

            // Replace the outer select clause...
            queryModel.SelectClause.TransformExpressions(s => GroupBySelectClauseRewriter.ReWrite(s, groupBy, subQueryExpression.QueryModel));

            queryModel.SelectClause.TransformExpressions(
                s =>
                new SwapQuerySourceVisitor(queryModel.MainFromClause, subQueryExpression.QueryModel.MainFromClause).Swap
                    (s));

            MainFromClause innerMainFromClause = subQueryExpression.QueryModel.MainFromClause;
            CopyFromClauseData(innerMainFromClause, fromClause);

            foreach (var bodyClause in subQueryExpression.QueryModel.BodyClauses)
            {
                queryModel.BodyClauses.Add(bodyClause);
            }

            queryModel.ResultOperators.Add(groupBy);
        }
开发者ID:umittal,项目名称:MunimJi,代码行数:29,代码来源:AggregatingGroupByRewriter.cs


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