本文整理汇总了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,
//.........这里部分代码省略.........
示例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(
//.........这里部分代码省略.........