本文整理汇总了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);
}
示例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();
}
示例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);
}