本文整理汇总了C#中ScopedDictionary.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ScopedDictionary.Add方法的具体用法?C# ScopedDictionary.Add怎么用?C# ScopedDictionary.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScopedDictionary
的用法示例。
在下文中一共展示了ScopedDictionary.Add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindSimilarRight
private Expression FindSimilarRight(JoinExpression join, JoinExpression compareTo)
{
if (join == null)
{
return null;
}
if (join.Join == compareTo.Join)
{
if (join.Right.NodeType == compareTo.Right.NodeType && DbExpressionComparer.AreEqual(join.Right, compareTo.Right))
{
if (join.Condition == compareTo.Condition)
{
return join.Right;
}
var scope = new ScopedDictionary<TableAlias, TableAlias>(null);
scope.Add(((AliasedExpression)join.Right).Alias, ((AliasedExpression)compareTo.Right).Alias);
if (DbExpressionComparer.AreEqual(null, scope, join.Condition, compareTo.Condition))
{
return join.Right;
}
}
}
Expression result = FindSimilarRight(join.Left as JoinExpression, compareTo);
if (result == null)
{
result = FindSimilarRight(join.Right as JoinExpression, compareTo);
}
return result;
}
示例2: CompareLambda
protected virtual bool CompareLambda(LambdaExpression a, LambdaExpression b)
{
int n = a.Parameters.Count;
if (b.Parameters.Count != n)
return false;
// all must have same type
for (int i = 0; i < n; i++)
{
if (a.Parameters[i].Type != b.Parameters[i].Type)
return false;
}
var save = _parameterScope;
_parameterScope = new ScopedDictionary<ParameterExpression, ParameterExpression>(_parameterScope);
try
{
for (int i = 0; i < n; i++)
{
_parameterScope.Add(a.Parameters[i], b.Parameters[i]);
}
return Compare(a.Body, b.Body);
}
finally
{
_parameterScope = save;
}
}
示例3: CompareProjection
protected virtual bool CompareProjection(ProjectionExpression a, ProjectionExpression b)
{
if (!Compare(a.Source, b.Source))
return false;
var save = aliasScope;
try
{
aliasScope = new ScopedDictionary<TableAlias, TableAlias>(aliasScope);
aliasScope.Add(a.Source.Alias, b.Source.Alias);
return Compare(a.Projector, b.Projector)
&& Compare(a.Aggregator, b.Aggregator)
&& a.IsSingleton == b.IsSingleton;
}
finally
{
aliasScope = save;
}
}
示例4: CompareProjection
protected virtual bool CompareProjection(DbProjectionExpression a,
DbProjectionExpression b)
{
if (!Compare(a.Select, b.Select))
return false;
ScopedDictionary<DbTableAlias, DbTableAlias> save = _aliasScope;
try
{
_aliasScope = new ScopedDictionary<DbTableAlias, DbTableAlias>(_aliasScope);
_aliasScope.Add(a.Select.Alias, b.Select.Alias);
return Compare(a.Projector, b.Projector)
&& Compare(a.Aggregator, b.Aggregator)
&& a.IsSingleton == b.IsSingleton;
}
finally
{
_aliasScope = save;
}
}