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


C# IExpressionGraph.GetNewInstance方法代码示例

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


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

示例1: Calculon

        /// <summary>
        /// This method evaluates binary expressions.
        /// </summary>
        public IExpressionGraph Calculon(GQLPluginManager myPluginManager, 
                                            IGraphDB myGraphDB, 
                                            SecurityToken mySecurityToken, 
                                            Int64 myTransactionToken, 
                                            IExpressionGraph resultGraph, 
                                            bool aggregateAllowed = true)
        {
            //a leaf expression is a expression without any recursive BinaryExpression
            if (IsLeafExpression())
            {
                #region process leaf expression

                return ABinaryCompareOperator.TypeOperation(
                                                this.Left, 
                                                this.Right,
                                                myPluginManager, 
                                                myGraphDB, 
                                                mySecurityToken, 
                                                myTransactionToken,
                                                this.TypeOfBinaryExpression,
                                                resultGraph,
                                                TypesOfOperators.AffectsLocalLevelOnly, 
                                                Operator,
                                                this.ExpressionIndex,
                                                aggregateAllowed);

                #endregion
            }
            else
            {
                #region process sub expr

                switch (this.TypeOfBinaryExpression)
                {
                    case TypesOfBinaryExpression.LeftComplex:

                        #region left complex

                        if (this.Left is BinaryExpressionDefinition)
                        {
                            return ((BinaryExpressionDefinition)this.Left)
                                        .Calculon(myPluginManager, 
                                                    myGraphDB, 
                                                    mySecurityToken, 
                                                    myTransactionToken, 
                                                    resultGraph
                                                        .GetNewInstance(myGraphDB, mySecurityToken, myTransactionToken), 
                                                    aggregateAllowed);
                        }
                        else
                        {
                            throw new InvalidBinaryExpressionException(this);
                        }

                        #endregion

                    case TypesOfBinaryExpression.RightComplex:

                        #region right complex

                        if (this.Right is BinaryExpressionDefinition)
                        {
                            return ((BinaryExpressionDefinition)this.Right)
                                        .Calculon(myPluginManager, 
                                                    myGraphDB, 
                                                    mySecurityToken, 
                                                    myTransactionToken, 
                                                    resultGraph
                                                        .GetNewInstance(myGraphDB, mySecurityToken, myTransactionToken), 
                                                    aggregateAllowed);
                        }
                        else
                        {
                            throw new InvalidBinaryExpressionException(this);
                        }

                        #endregion

                    case TypesOfBinaryExpression.Complex:

                        #region complex

                        if (!((this.Left is BinaryExpressionDefinition) && (this.Right is BinaryExpressionDefinition)))
                        {
                            throw new InvalidBinaryExpressionException(this);
                        }

                        if (!(this.Operator == BinaryOperator.OR || this.Operator == BinaryOperator.AND))
                        {
                            throw new InvalidBinaryExpressionException(this);                            
                        }

                        var left = ((BinaryExpressionDefinition)this.Left)
                                        .Calculon(myPluginManager, 
                                                    myGraphDB, 
                                                    mySecurityToken, 
                                                    myTransactionToken, 
//.........这里部分代码省略.........
开发者ID:anukat2015,项目名称:sones,代码行数:101,代码来源:BinaryExpressionDefinition.cs

示例2: Calculon

        /// <summary>
        /// This method evaluates binary expressions.
        /// </summary>
        /// <param name="currentTypeDefinition">KeyValuePair of Reference and corresponding GraphType.</param>
        /// <param name="referenceList">List of References.</param>
        /// <param name="dbContext">The TypeManager of the GraphDB.</param>
        /// <param name="queryCache">The current query cache.</param>
        /// <param name="resultGraph">A template of the result graph</param>
        /// <returns>A GraphResult container.</returns>
        public Exceptional<IExpressionGraph> Calculon(DBContext dbContext, IExpressionGraph resultGraph, bool aggregateAllowed = true)
        {
            //a leaf expression is a expression without any recursive BinaryExpression
            if (IsLeafExpression())
            {
                #region process leaf expression

                return this.Operator.TypeOperation(
                    this.Left, this.Right, dbContext,
                    this.TypeOfBinaryExpression,
                    GetAssociativityReloaded(ExtractIDNode(this.Left), ExtractIDNode(this.Right)),
                   resultGraph,
                   aggregateAllowed);

                #endregion
            }
            else
            {
                #region process sub expr

                switch (this.TypeOfBinaryExpression)
                {
                    case TypesOfBinaryExpression.LeftComplex:

                        #region left complex

                        if (this.Left is BinaryExpressionDefinition)
                        {
                            return ((BinaryExpressionDefinition)this.Left).Calculon(dbContext, resultGraph.GetNewInstance(dbContext), aggregateAllowed);
                        }
                        else
                        {
                            return new Exceptional<IExpressionGraph>(new Error_InvalidBinaryExpression(this));
                        }

                        #endregion

                    case TypesOfBinaryExpression.RightComplex:

                        #region right complex

                        if (this.Right is BinaryExpressionDefinition)
                        {
                            return ((BinaryExpressionDefinition)this.Right).Calculon(dbContext, resultGraph.GetNewInstance(dbContext), aggregateAllowed);
                        }
                        else
                        {
                            return new Exceptional<IExpressionGraph>(new Error_InvalidBinaryExpression(this));
                        }

                        #endregion

                    case TypesOfBinaryExpression.Complex:

                        #region complex

                        var runMT = DBConstants.RunMT;

                        if (!((this.Left is BinaryExpressionDefinition) && (this.Right is BinaryExpressionDefinition)))
                        {
                            return new Exceptional<IExpressionGraph>(new Error_InvalidBinaryExpression(this));
                        }

                        if (!(this.Operator is ABinaryLogicalOperator))
                        {
                            return new Exceptional<IExpressionGraph>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                        }

                        if (runMT)
                        {
                            var leftTask = Task<Exceptional<IExpressionGraph>>.Factory.StartNew(() =>
                            {
                                return ((BinaryExpressionDefinition)this.Left).Calculon(dbContext, resultGraph.GetNewInstance(dbContext), aggregateAllowed);
                            });

                            var rightTask = Task<Exceptional<IExpressionGraph>>.Factory.StartNew(() =>
                            {
                                return ((BinaryExpressionDefinition)this.Right).Calculon(dbContext, resultGraph.GetNewInstance(dbContext), aggregateAllowed);
                            });

                            if (!leftTask.Result.Success())
                            {
                                return new Exceptional<IExpressionGraph>(leftTask.Result);
                            }

                            if (!rightTask.Result.Success())
                            {
                                return new Exceptional<IExpressionGraph>(rightTask.Result);
                            }

                            return (this.Operator as ABinaryLogicalOperator).TypeOperation(
//.........这里部分代码省略.........
开发者ID:ipbi,项目名称:sones,代码行数:101,代码来源:BinaryExpressionDefinition.cs


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