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


C# QueryModel.GetResultType方法代码示例

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


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

示例1: GenerateSparqlQuery

 public static SparqlQueryContext GenerateSparqlQuery(EntityContext context, QueryModel queryModel)
 {
     var visitor = new SparqlGeneratorQueryModelVisitor(context);
     visitor.VisitQueryModel(queryModel);
     var resultType = queryModel.GetResultType();
     if (resultType.IsGenericType)
     {
         resultType = resultType.GetGenericArguments()[0];
     }
     var bindType = context.GetImplType(resultType);
     bool useDescribe = typeof (IEntityObject).IsAssignableFrom(bindType);
     return visitor.GetSparqlQuery(useDescribe);
 }
开发者ID:Garwin4j,项目名称:BrightstarDB,代码行数:13,代码来源:SparqlGeneratorQueryModelVisitor.cs

示例2: VisitQueryModel

            /// <summary>
            /// The main entry point that we watch - we generate a method info stub when we need it
            /// from this.
            /// </summary>
            /// <param name="queryModel"></param>
            public override void VisitQueryModel(QueryModel queryModel)
            {
                // If the type is something that is friendly to be returned from a
                // method, then we should cache this guy.

                _qmContextStack.Push(new QMContext());

                // Now, run through the query model.

                base.VisitQueryModel(queryModel);

                // And if the QM result type is something we can reasonably cache, then we should do it.
                //  - Do not cache the outter most QM. This guy has the best place to start combining things.
                //  - Do not cache anything that is enumerable. We'll have to deal with that later.
                //  - Do not cache any anonymous types
                //  - Deal with later somethign that is an iterator (used in a later loop).

                var isEnumerable = typeof(IEnumerable).IsAssignableFrom(queryModel.GetResultType());
                var selectSequence = !queryModel.ResultOperators.Any();
                if (_qmContextStack.Count > 1
                    && ((selectSequence && isGoodSelectSequenceType(queryModel.GetResultType())) || !isEnumerable)
                    && !queryModel.GetResultType().IsClass
                    )
                {
                    var qmText = FormattingQueryVisitor.Format(queryModel);
                    if (!FoundFunctions.Where(ff => ff.QMText == qmText).Any())
                    {
                        var sref = _qmContextStack.Peek();
                        var f = new QMFuncHeader()
                        {
                            QM = queryModel,
                            QMText = qmText,
                            Arguments = sref._arguments.Cast<object>(),
                            IsSequence = selectSequence
                        };
                        FoundFunctions.Add(f);
                    }
                }

                // Go back to working on the previous qm.
                _qmContextStack.Pop();
            }
开发者ID:gordonwatts,项目名称:LINQtoROOT,代码行数:47,代码来源:QMFuncFinder.cs

示例3: ProcessSubquery

		private static Expression ProcessSubquery(ISessionFactory sessionFactory, ICollection<ExpressionHolder> elementExpression, QueryModel queryModel, Expression @group, QueryModel subQueryModel)
		{
			var subQueryMainFromClause = subQueryModel.MainFromClause;

			var restrictions = subQueryModel.BodyClauses
											.OfType<WhereClause>()
											.Select(w => new NhWithClause(w.Predicate));

			var join = new NhJoinClause(subQueryMainFromClause.ItemName,
										subQueryMainFromClause.ItemType,
										subQueryMainFromClause.FromExpression,
										restrictions);

			queryModel.BodyClauses.Add(@join);

			var visitor = new SwapQuerySourceVisitor(subQueryMainFromClause, @join);

			queryModel.TransformExpressions(visitor.Swap);

			var selector = subQueryModel.SelectClause.Selector;

			var collectionType = subQueryModel.GetResultType();
			
			var elementType = selector.Type;

			var source = new QuerySourceReferenceExpression(@join);

			return BuildSubCollectionQuery(sessionFactory, elementExpression, @group, source, selector, elementType, collectionType);
		}
开发者ID:whut,项目名称:nhibernate-core,代码行数:29,代码来源:NestedSelectRewriter.cs


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