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


C# ResultOperatorBase.GetType方法代码示例

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


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

示例1: VisitResultOperator

#pragma warning restore 649

        /// <summary>
        /// Process a result operator. If this result is amenable to be made into a function, then
        /// do so.
        /// </summary>
        /// <param name="resultOperator"></param>
        /// <param name="queryModel"></param>
        /// <param name="index"></param>
        public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index)
        {
            // Look for a single-result processor

            var processor = _operators.FindScalarROProcessor(resultOperator.GetType());
            if (processor != null)
            {
                var result = processor.ProcessResultOperator(resultOperator, queryModel, _codeEnv, _codeContext, MEFContainer);
                if (result != null)
                {
                    _codeEnv.SetResult(result);
                    _scoping.Add(_codeContext.Add(queryModel, result));
                }
                return;
            }

            // Look for a sequence processor

            var collectionProcessor = _operators.FindCollectionROProcessor(resultOperator.GetType());
            if (collectionProcessor != null)
            {
                collectionProcessor.ProcessResultOperator(resultOperator, queryModel, _codeEnv, _codeContext, MEFContainer);
                _codeEnv.ResetResult();
                return;
            }

            ///
            /// Uh oh - no idea how to do this!
            /// 

            throw new InvalidOperationException("LINQToTTree can't translate the operator '" + resultOperator.ToString() + "'");
        }
开发者ID:gordonwatts,项目名称:LINQtoROOT,代码行数:41,代码来源:QueryVisitor.cs

示例2: HandleResultOperator

        public virtual Expression HandleResultOperator(
            EntityQueryModelVisitor entityQueryModelVisitor,
            ResultOperatorBase resultOperator,
            QueryModel queryModel)
        {
            Check.NotNull(entityQueryModelVisitor, nameof(entityQueryModelVisitor));
            Check.NotNull(resultOperator, nameof(resultOperator));
            Check.NotNull(queryModel, nameof(queryModel));

            ResultHandler handler;
            if (!_handlers.TryGetValue(resultOperator.GetType(), out handler))
            {
                throw new NotImplementedException(resultOperator.GetType().ToString());
            }

            return handler(entityQueryModelVisitor, resultOperator, queryModel);
        }
开发者ID:aishaloshik,项目名称:EntityFramework,代码行数:17,代码来源:ResultOperatorHandler.cs

示例3: VisitResultOperator

 /// <summary>
 /// Visits the result operator.
 /// </summary>
 /// <param name="resultOperator">The result operator.</param>
 /// <param name="queryModel">The query model.</param>
 /// <param name="index">The index.</param>
 public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index)
 {
     if (resultOperator is CountResultOperator)
     {
         this.IsCount = true;
     }
     else
         throw new NotSupportedException(string.Format("Operator {0} is not supported.", resultOperator.GetType()));
 }
开发者ID:andoco,项目名称:mongodb-csharp,代码行数:15,代码来源:ScalarQueryModelVisitor.cs

示例4: VisitResultOperator

        public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index)
        {
            var handler = resultOperators.GetItem(resultOperator.GetType());

            if (handler != null)
            {
                handler.Accept(resultOperator, model);
            }
            else
            {
                model.ApplyUnsupported(resultOperator);
            }

            base.VisitResultOperator(resultOperator, queryModel, index);
        }
开发者ID:dpvreony-forks,项目名称:Lucene.Net.Linq,代码行数:15,代码来源:QueryModelTranslator.cs

示例5: VisitResultOperator

        /// <summary>
        /// Visits the result operator.
        /// </summary>
        /// <param name="resultOperator">The result operator.</param>
        /// <param name="queryModel">The query model.</param>
        /// <param name="index">The index.</param>
        public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index)
        {
            if (resultOperator is SkipResultOperator)
            {
                if (index > 0 && this.querySpec.Limit > 0)
                    throw new NotSupportedException("Skip operators must come before Take operators.");

                var constantExpression = ((SkipResultOperator)resultOperator).Count as ConstantExpression;
                if (constantExpression == null)
                    throw new NotSupportedException("Only constant skip counts are supported.");
                this.querySpec.Skip = (int)constantExpression.Value;
            }
            else if (resultOperator is TakeResultOperator)
            {
                var constantExpression = ((TakeResultOperator)resultOperator).Count as ConstantExpression;
                if (constantExpression == null)
                    throw new NotSupportedException("Only constant take counts are supported.");
                this.querySpec.Limit = (int)constantExpression.Value;
            }
            else if (resultOperator is FirstResultOperator || resultOperator is SingleResultOperator)
            {
                this.querySpec.Limit = 1;
            }
            else
                throw new NotSupportedException(string.Format("Operator {0} is not supported.", resultOperator.GetType()));
        }
开发者ID:andoco,项目名称:mongodb-csharp,代码行数:32,代码来源:CollectionQueryModelVisitor.cs

示例6: VisitResultOperator

        public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index)
        {
            if (resultOperator is AnyResultOperator ||
                resultOperator is CountResultOperator ||
                resultOperator is LongCountResultOperator ||
                resultOperator is FirstResultOperator ||
                resultOperator is SingleResultOperator)
            {
                return;
            }

            var takeOperator = resultOperator as TakeResultOperator;
            if (takeOperator != null)
            {
                var count = takeOperator.GetConstantCount();
                if (Count != null)
                {
                    count = Math.Min(count, Count.Value);
                }

                Count = count;
                return;
            }

            var skipOperator = resultOperator as SkipResultOperator;
            if (skipOperator != null)
            {
                var startIndex = skipOperator.GetConstantCount();
                if (Count != null)
                {
                    Count = Math.Max(Count.Value - startIndex, 0);
                }

                StartIndex = (StartIndex ?? 1) + startIndex;
                return;
            }

            var fetchOperator = resultOperator as FetchResultOperator;
            if (fetchOperator != null)
            {
                var paths = PropertyPathExtractionVisitor.ExtractPaths(fetchOperator.Selector, _nodeTypeProvider, false, false, _namingScheme, "/");
                if (paths.Count > 0)
                {
                    if (Include != null)
                    {
                        Include += ",";
                    }
                    Include += string.Join(",", paths.ToArray());
                }

                return;
            }

            var withPrecedenceOperator = resultOperator as WithPrecedenceResultOperator;
            if (withPrecedenceOperator != null)
            {
                Precedence = Math.Min(Precedence ?? int.MaxValue, withPrecedenceOperator.Precedence);
                return;
            }

            var withExtensionArgOperator = resultOperator as WithExtensionArgResultOperator;
            if (withExtensionArgOperator != null)
            {
                ExtensionArgs[withExtensionArgOperator.Name] = withExtensionArgOperator.Value;
                return;
            }

            #if !NET_3_5
            if (resultOperator is ToCollectionAsyncResultOperator)
            {
                return;
            }
            #endif

            throw new NotSupportedException(string.Format("Result operator '{0}' not supported", resultOperator.GetType()));
        }
开发者ID:nicocrm,项目名称:DotNetSDataClient,代码行数:76,代码来源:SDataQueryModelVisitor.cs

示例7: VisitResultOperator

        /// <summary>
        /// Visits the result operator.
        /// </summary>
        /// <param name="resultOperator">The result operator.</param>
        /// <param name="queryModel">The query model.</param>
        /// <param name="index">The index.</param>
        /// <remarks></remarks>
        public override void VisitResultOperator(ResultOperatorBase resultOperator, Remotion.Linq.QueryModel queryModel, int index)
        {
            if (typeof(CountResultOperator).IsAssignableFrom(resultOperator.GetType()))
            {
                //_queryDescription.SetResultFilterClause(queryModel.MainFromClause.ItemType, ResultFilterType.Count, 0);
                _queryDescription.AddResultFilter(queryModel.MainFromClause.ItemType, ResultFilterType.Count, 0);
            }

            if (typeof(SingleResultOperator).IsAssignableFrom(resultOperator.GetType()))
            {
                var op = resultOperator as SingleResultOperator;
                var filter = op.ReturnDefaultWhenEmpty ? ResultFilterType.SingleOrDefault : ResultFilterType.Single;
                //_queryDescription.SetResultFilterClause(queryModel.MainFromClause.ItemType, filter, 0);
                _queryDescription.AddResultFilter(queryModel.MainFromClause.ItemType, filter, 0);
            }

            if (typeof(TakeResultOperator).IsAssignableFrom(resultOperator.GetType()))
            {
                var firstResultOperator = resultOperator as TakeResultOperator;
                var countExpression = firstResultOperator.Count as ConstantExpression;
                var count = Convert.ToInt32(countExpression.Value);
                //_queryDescription.SetTakeResultFilter(queryModel.MainFromClause.ItemType, count);
                _queryDescription.AddTakeResultFilter(queryModel.MainFromClause.ItemType, count);
            }

            var skipResultOp = resultOperator as SkipResultOperator;
            if (skipResultOp != null)
            {
                var countExpression = skipResultOp.Count as ConstantExpression;
                var count = Convert.ToInt32(countExpression.Value);
                //_queryDescription.SetSkipResultFilter(queryModel.MainFromClause.ItemType, count);
                _queryDescription.AddSkipResultFilter(queryModel.MainFromClause.ItemType, count);
            }

            if (resultOperator is AnyResultOperator)
            {
                //_queryDescription.SetResultFilterClause(queryModel.MainFromClause.ItemType, ResultFilterType.Any, 0);
                _queryDescription.AddResultFilter(queryModel.MainFromClause.ItemType, ResultFilterType.Any, 0);
            }

            var allResultOp = resultOperator as AllResultOperator;
            if (allResultOp != null)
            {
                var criteriaExpression = this.GetCriteriaExpression(queryModel, allResultOp.Predicate);
                _queryDescription.SetCriteria(criteriaExpression);
                //_queryDescription.SetResultFilterClause(queryModel.MainFromClause.ItemType, ResultFilterType.All, 0);
                _queryDescription.AddResultFilter(queryModel.MainFromClause.ItemType, ResultFilterType.All, 0);
            }

            var firstResultOp = resultOperator as FirstResultOperator;
            if (firstResultOp != null)
            {
                //this._queryDescription.SetResultFilterClause(
                //    queryModel.MainFromClause.ItemType,
                //    firstResultOp.ReturnDefaultWhenEmpty ? ResultFilterType.FirstOrDefault : ResultFilterType.First,
                //    0);

                this._queryDescription.AddResultFilter(
                    queryModel.MainFromClause.ItemType,
                    firstResultOp.ReturnDefaultWhenEmpty ? ResultFilterType.FirstOrDefault : ResultFilterType.First,
                    0);
            }

            var lastResultOp = resultOperator as LastResultOperator;
            if (lastResultOp != null)
            {
                this._queryDescription.AddResultFilter(
                    queryModel.MainFromClause.ItemType,
                    lastResultOp.ReturnDefaultWhenEmpty ? ResultFilterType.LastOrDefault : ResultFilterType.Last,
                    0);
            }

            base.VisitResultOperator(resultOperator, queryModel, index);
        }
开发者ID:paulsuart,项目名称:rebelcmsxu5,代码行数:81,代码来源:QueryModelVisitor.cs

示例8: VisitResultOperator

        public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index)
        {
            string value;
            if (resultOperatorMap.TryGetValue (resultOperator.GetType (), out value)) {
                queryParts.SelectPart = string.Format (value, queryParts.SelectPart);
            } else {
                throw new NotSupportedException ();
            }

            base.VisitResultOperator (resultOperator, queryModel, index);
        }
开发者ID:bdkoepke,项目名称:YQLinq,代码行数:11,代码来源:YqlGeneratorQueryModelVisitor.cs

示例9: VisitResultOperator

    public override void VisitResultOperator (ResultOperatorBase resultOperator, QueryModel queryModel, int index)
    {
      ArgumentUtility.CheckNotNull ("resultOperator", resultOperator);
      ArgumentUtility.CheckNotNull ("queryModel", queryModel);

      var operatorType = resultOperator.GetType();
      
      var resultOperatorHandler = _resultOperatorHandlerRegistry.GetItem (operatorType);
      if (resultOperatorHandler == null)
      {
        string message = string.Format (
            "The result operator '{0}' is not supported and no custom handler has been registered.",
            operatorType.Name);
        throw new NotSupportedException (message);
      }

      resultOperatorHandler.HandleResultOperator (resultOperator, _sqlStatementBuilder, _generator, _stage, _context);
    }
开发者ID:re-motion,项目名称:Relinq-SqlBackend,代码行数:18,代码来源:SqlPreparationQueryModelVisitor.cs

示例10: VisitResultOperator


//.........这里部分代码省略.........
                    // So we need to prefix the references to the subquery in the predicate with the iterator name from the ALL clause

                    _queryPartsAggregator.PropertyExtractionPart =
                        _queryGenerationContext.ExtentNameProvider.GetUnlinkedExtentName();

                    prefixedExtents = true;
                    _queryGenerationContext.ExtentNameProvider.Prefix = _queryPartsAggregator.PropertyExtractionPart + ".";
                }
                else if (_queryPartsAggregator.QueryType == N1QlQueryType.ArrayAll)
                {
                    // We're dealing with an array-type subquery
                    // If there is any pre-filtering on the array using a Where clause, these statements will be
                    // referencing the query source using the default extent name.  When we apply the SATISFIES clause
                    // we'll need to use a new extent name to reference the results of the internal WHERE clause.

                    _queryPartsAggregator.PropertyExtractionPart =
                        _queryGenerationContext.ExtentNameProvider.GenerateNewExtentName(queryModel.MainFromClause);
                }

                var allResultOperator = (AllResultOperator) resultOperator;
                _queryPartsAggregator.WhereAllPart = GetN1QlExpression(allResultOperator.Predicate);

                if (prefixedExtents)
                {
                    _queryGenerationContext.ExtentNameProvider.Prefix = null;
                }
            }
            else if (resultOperator is ContainsResultOperator)
            {
                if (_queryPartsAggregator.QueryType != N1QlQueryType.Array)
                {
                    throw new NotSupportedException("Contains is only supported in N1QL against nested or constant arrays.");
                }

                var containsResultOperator = (ContainsResultOperator) resultOperator;

                // Use a wrapping function to wrap the subquery with an IN statement

                _queryPartsAggregator.AddWrappingFunction(GetN1QlExpression(containsResultOperator.Item) + " IN ");
            }
            else if (resultOperator is GroupResultOperator)
            {
                VisitGroupResultOperator((GroupResultOperator)resultOperator, queryModel);
            }
            else if (resultOperator is AverageResultOperator)
            {
                _queryPartsAggregator.AggregateFunction = "AVG";
                _isAggregated = true;
            }
            else if ((resultOperator is CountResultOperator) || (resultOperator is LongCountResultOperator))
            {
                _queryPartsAggregator.AggregateFunction = "COUNT";
                _isAggregated = true;
            }
            else if (resultOperator is MaxResultOperator)
            {
                _queryPartsAggregator.AggregateFunction = "MAX";
                _isAggregated = true;
            }
            else if (resultOperator is MinResultOperator)
            {
                _queryPartsAggregator.AggregateFunction = "MIN";
                _isAggregated = true;
            }
            else if (resultOperator is SumResultOperator)
            {
                _queryPartsAggregator.AggregateFunction = "SUM";
                _isAggregated = true;
            }
            else if (resultOperator is UnionResultOperator)
            {
                EnsureNotArraySubquery();

                var source = ((UnionResultOperator) resultOperator).Source2 as SubQueryExpression;
                if (source == null)
                {
                    throw new NotSupportedException("Union is only support against query sources.");
                }

                VisitUnion(source, true);
            }
            else if (resultOperator is ConcatResultOperator)
            {
                EnsureNotArraySubquery();

                var source = ((ConcatResultOperator)resultOperator).Source2 as SubQueryExpression;
                if (source == null)
                {
                    throw new NotSupportedException("Concat is only support against query sources.");
                }

                VisitUnion(source, false);
            }
            else
            {
                throw new NotSupportedException(string.Format("{0} is not supported.", resultOperator.GetType().Name));
            }

            base.VisitResultOperator(resultOperator, queryModel, index);
        }
开发者ID:akorczynski,项目名称:Linq2Couchbase,代码行数:101,代码来源:N1QLQueryModelVisitor.cs

示例11: VisitResultOperator

        /// <summary>Visits a result operator.</summary>
        /// <param name="resultOperator">Result operator to be visited.</param>
        /// <param name="queryModel">Query model containing given from clause.</param>
        /// <param name="index">Index of the visited result operator in the result operators collection.</param>
        public override void VisitResultOperator(ResultOperatorBase resultOperator, Remotion.Linq.QueryModel queryModel, int index)
        {
            MethodInfo visitResultOperatorMethod = GetType().GetMethod("Visit" + resultOperator.GetType().Name, BindingFlags.Instance | BindingFlags.NonPublic);
            if (visitResultOperatorMethod != null)
            {
                visitResultOperatorMethod.Invoke(this, new object[] { resultOperator, queryModel, index });
            }
            else
            {
                throw new NotSupportedException(System.String.Format("Expressions of type '{0}' are not supported.", resultOperator.GetType().Name.Replace("ResultOperator", System.String.Empty)));
            }

            base.VisitResultOperator(resultOperator, queryModel, index);
        }
开发者ID:rafalrosochacki,项目名称:RomanticWeb,代码行数:18,代码来源:NonEntityQueryModelVisitor.cs

示例12: VisitResultOperator

        public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index)
        {
            if (ResultOperatorHandlers.ContainsKey(resultOperator.GetType()))
            {
                var method = ResultOperatorHandlers[resultOperator.GetType()];
                _aggegrator.Add(method.Invoke(resultOperator, _values));
            }

            base.VisitResultOperator(resultOperator, queryModel, index);
        }
开发者ID:benjaminramey,项目名称:GoodlyFere.Ektron.Linq,代码行数:10,代码来源:SubQueryTransformationVisitor.cs

示例13: ProcessClientSideResultOperator

        private void ProcessClientSideResultOperator(ResultOperatorBase resultOperator)
        {
			if (resultOperator is NonAggregatingGroupBy)
			{
				ProcessNonAggregatingGroupBy((NonAggregatingGroupBy) resultOperator);
			}
            else if (resultOperator is ClientSideSelect)
            {
                ProcessClientSideSelect((ClientSideSelect) resultOperator);
            }
			else
			{
				throw new NotSupportedException(string.Format("The {0} result operator is not current supported",
				                                              resultOperator.GetType().Name));
			}
        }
开发者ID:nkmajeti,项目名称:nhibernate,代码行数:16,代码来源:QueryModelVisitor.cs

示例14: ProcessServerSideResultOperator

 private void ProcessServerSideResultOperator(ResultOperatorBase resultOperator)
 {
     if (resultOperator is FirstResultOperator)
     {
         ProcessFirstOperator();
     }
     else if (resultOperator is TakeResultOperator)
     {
         ProcessTakeOperator((TakeResultOperator)resultOperator);
     }
     else if (resultOperator is SkipResultOperator)
     {
         ProcessSkipOperator((SkipResultOperator)resultOperator);
     }
     else if (resultOperator is GroupResultOperator)
     {
         ProcessGroupByOperator((GroupResultOperator)resultOperator);
     }
     else
     {
         throw new NotSupportedException(string.Format("The {0} result operator is not current supported",
                                                       resultOperator.GetType().Name));
     }
 }
开发者ID:nkmajeti,项目名称:nhibernate,代码行数:24,代码来源:QueryModelVisitor.cs

示例15: VisitResultOperator

		public override void VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, int index)
		{
            if (typeof(ClientSideTransformOperator).IsAssignableFrom(resultOperator.GetType()))
            {
                if (_resultOperatorProcessingMode == ResultOperatorProcessingMode.ProcessClientSide)
                {
                    ProcessClientSideResultOperator(resultOperator);
                }
            }
            else
            {
                if (_resultOperatorProcessingMode == ResultOperatorProcessingMode.ProcessServerSide)
                {
                    ProcessServerSideResultOperator(resultOperator);
                }
            }

			base.VisitResultOperator(resultOperator, queryModel, index);
		}
开发者ID:nkmajeti,项目名称:nhibernate,代码行数:19,代码来源:QueryModelVisitor.cs


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