本文整理汇总了C#中ScopedDictionary类的典型用法代码示例。如果您正苦于以下问题:C# ScopedDictionary类的具体用法?C# ScopedDictionary怎么用?C# ScopedDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScopedDictionary类属于命名空间,在下文中一共展示了ScopedDictionary类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: VisitMemberInit
protected override Expression VisitMemberInit(MemberInitExpression init)
{
if (this.mapping.IsEntity(init.Type))
{
var save = this.includeScope;
this.includeScope = new ScopedDictionary<MemberInfo,bool>(this.includeScope);
Dictionary<MemberInfo, MemberBinding> existing = init.Bindings.ToDictionary(b => b.Member);
List<MemberBinding> newBindings = null;
foreach (var mi in this.mapping.GetMappedMembers(init.Type))
{
if (!existing.ContainsKey(mi) && this.mapping.IsRelationship(mi) && this.policy.IsIncluded(mi))
{
if (this.includeScope.ContainsKey(mi))
{
throw new NotSupportedException(string.Format("Cannot include '{0}.{1}' recursively.", mi.DeclaringType.Name, mi.Name));
}
Expression me = this.mapping.GetMemberExpression(init, mi);
if (newBindings == null)
{
newBindings = new List<MemberBinding>(init.Bindings);
}
newBindings.Add(Expression.Bind(mi, me));
}
}
if (newBindings != null)
{
init = Expression.MemberInit(init.NewExpression, newBindings);
}
this.includeScope = save;
}
return base.VisitMemberInit(init);
}
开发者ID:RyanDansie,项目名称:SubSonic-3.0,代码行数:34,代码来源:RelationshipIncluder.cs
示例2: VisitEntity
protected override Expression VisitEntity(EntityExpression entity)
{
var save = this.includeScope;
this.includeScope = new ScopedDictionary<MemberInfo, bool>(this.includeScope);
try
{
if (this.mapper.HasIncludedMembers(entity))
{
entity = this.mapper.IncludeMembers(
entity,
m =>
{
if (this.includeScope.ContainsKey(m))
{
return false;
}
if (this.policy.IsIncluded(m))
{
this.includeScope.Add(m, true);
return true;
}
return false;
});
}
return base.VisitEntity(entity);
}
finally
{
this.includeScope = save;
}
}
开发者ID:PaybackMan,项目名称:Cinder,代码行数:31,代码来源:RelationshipIncluder.cs
示例3: 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;
}
开发者ID:mattleibow,项目名称:Mono.Data.Sqlite.Orm.Linq,代码行数:29,代码来源:RedundantJoinRemover.cs
示例4: ToString
public override string ToString()
{
StringBuilder sb = new StringBuilder();
ScopedDictionary<string, ValueProviderBase> variables = new ScopedDictionary<string, ValueProviderBase>(null);
ToString(sb, variables);
return sb.ToString();
}
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:7,代码来源:EmailTemplateParser.Nodes.cs
示例5: DbExpressionComparer
protected DbExpressionComparer(ScopedDictionary<ParameterExpression,
ParameterExpression> parameterScope,
ScopedDictionary<DbTableAlias, DbTableAlias> aliasScope)
: base(parameterScope)
{
_aliasScope = aliasScope;
}
开发者ID:radischevo,项目名称:Radischevo.Wahha,代码行数:7,代码来源:DbExpressionComparer.cs
示例6: AreEqual
public static bool AreEqual(
ScopedDictionary<ParameterExpression, ParameterExpression> parameterScope,
Expression a,
Expression b,
Func<object, object, bool> fnCompare)
{
return new ExpressionComparer(parameterScope, fnCompare).Compare(a, b);
}
开发者ID:mattleibow,项目名称:Mono.Data.Sqlite.Orm.Linq,代码行数:8,代码来源:ExpressionComparer.cs
示例7: AreEqual
public static bool AreEqual(
ScopedDictionary<ParameterExpression, ParameterExpression> parameterScope,
ScopedDictionary<TableAlias, TableAlias> aliasScope,
Expression a,
Expression b)
{
return new DbExpressionComparer(parameterScope, null, aliasScope).Compare(a, b);
}
开发者ID:mattleibow,项目名称:Mono.Data.Sqlite.Orm.Linq,代码行数:8,代码来源:DbExpressionComparer.cs
示例8: ExpressionComparer
protected ExpressionComparer(
ScopedDictionary<ParameterExpression, ParameterExpression> parameterScope,
Func<object, object, bool> fnCompare
)
{
this.parameterScope = parameterScope;
this.fnCompare = fnCompare;
}
开发者ID:lepigocher,项目名称:iqtoolkit-oracle,代码行数:8,代码来源:ExpressionComparer.cs
示例9: DbExpressionComparer
protected DbExpressionComparer(
ScopedDictionary<ParameterExpression, ParameterExpression> parameterScope,
Func<object, object, bool> fnCompare,
ScopedDictionary<TableAlias, TableAlias> aliasScope)
: base(parameterScope, fnCompare)
{
this.aliasScope = aliasScope;
}
开发者ID:jogibear9988,项目名称:IQToolkit,代码行数:8,代码来源:DbExpressionComparer.cs
示例10: AreEqual
public static bool AreEqual(ScopedDictionary<ParameterExpression, ParameterExpression> parameterScope, Expression a, Expression b)
{
return new ExpressionComparer(parameterScope).Compare(a, b);
}
开发者ID:hamdouchi97,项目名称:Stump.ORM,代码行数:4,代码来源:ExpressionComparer.cs
示例11: ExpressionComparer
protected ExpressionComparer(ScopedDictionary<ParameterExpression, ParameterExpression> parameterScope)
{
this.parameterScope = parameterScope;
}
开发者ID:hamdouchi97,项目名称:Stump.ORM,代码行数:4,代码来源:ExpressionComparer.cs
示例12: 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 = this.parameterScope;
this.parameterScope = new ScopedDictionary<ParameterExpression, ParameterExpression>(this.parameterScope);
try
{
for (int i = 0; i < n; i++)
{
this.parameterScope.Add(a.Parameters[i], b.Parameters[i]);
}
return this.Compare(a.Body, b.Body);
}
finally
{
this.parameterScope = save;
}
}
开发者ID:hamdouchi97,项目名称:Stump.ORM,代码行数:26,代码来源:ExpressionComparer.cs
示例13: CompareSelect
protected virtual bool CompareSelect(SelectExpression a, SelectExpression b)
{
var save = this.aliasScope;
try
{
if (!this.Compare(a.From, b.From))
return false;
this.aliasScope = new ScopedDictionary<TableAlias, TableAlias>(save);
this.MapAliases(a.From, b.From);
return this.Compare(a.Where, b.Where)
&& this.CompareOrderList(a.OrderBy, b.OrderBy)
&& this.CompareExpressionList(a.GroupBy, b.GroupBy)
&& this.Compare(a.Skip, b.Skip)
&& this.Compare(a.Take, b.Take)
&& a.IsDistinct == b.IsDistinct
&& a.IsReverse == b.IsReverse
&& this.CompareColumnDeclarations(a.Columns, b.Columns);
}
finally
{
this.aliasScope = save;
}
}
开发者ID:jogibear9988,项目名称:IQToolkit,代码行数:25,代码来源:DbExpressionComparer.cs
示例14: RenderTemplate
protected internal override void RenderTemplate(ScopedDictionary<string, ValueProviderBase> variables)
{
foreach (var item in this.Descendants<BaseNode>().ToList())
{
item.RenderTemplate(variables);
}
}
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:7,代码来源:WordTemplateNodes.cs
示例15: SynchronizeWordTemplate
internal static SqlPreCommand SynchronizeWordTemplate(Replacements replacements, WordTemplateEntity template, StringDistance sd)
{
try
{
if (template.Template == null)
return null;
var queryName = QueryLogic.ToQueryName(template.Query.Key);
QueryDescription qd = DynamicQueryManager.Current.QueryDescription(queryName);
Console.Clear();
SafeConsole.WriteLineColor(ConsoleColor.White, "WordTemplate: " + template.Name);
Console.WriteLine(" Query: " + template.Query.Key);
var file = template.Template.Retrieve();
try
{
using (var memory = new MemoryStream())
{
memory.WriteAllBytes(file.BinaryFile);
using (WordprocessingDocument document = WordprocessingDocument.Open(memory, true))
{
Dump(document, "0.Original.txt");
var parser = new WordTemplateParser(document, qd, template.SystemWordTemplate.ToType());
parser.ParseDocument(); Dump(document, "1.Match.txt");
parser.CreateNodes(); Dump(document, "2.BaseNode.txt");
parser.AssertClean();
SyncronizationContext sc = new SyncronizationContext
{
ModelType = template.SystemWordTemplate.ToType(),
QueryDescription = qd,
Replacements = replacements,
StringDistance = sd,
HasChanges = false,
Variables = new ScopedDictionary<string, ValueProviderBase>(null),
};
foreach (var root in document.RecursivePartsRootElements())
{
foreach (var node in root.Descendants<BaseNode>().ToList())
{
node.Synchronize(sc);
}
}
if (!sc.HasChanges)
return null;
Dump(document, "3.Synchronized.txt");
var variables = new ScopedDictionary<string, ValueProviderBase>(null);
foreach (var root in document.RecursivePartsRootElements())
{
foreach (var node in root.Descendants<BaseNode>().ToList())
{
node.RenderTemplate(variables);
}
}
Dump(document, "4.Rendered.txt");
}
file.AllowChange = true;
file.BinaryFile = memory.ToArray();
using (replacements.WithReplacedDatabaseName())
return Schema.Current.Table<FileEntity>().UpdateSqlSync(file, comment: "WordTemplate: " + template.Name);
}
}
catch (TemplateSyncException ex)
{
if (ex.Result == FixTokenResult.SkipEntity)
return null;
if (ex.Result == FixTokenResult.DeleteEntity)
return SqlPreCommandConcat.Combine(Spacing.Simple,
Schema.Current.Table<WordTemplateEntity>().DeleteSqlSync(template),
Schema.Current.Table<FileEntity>().DeleteSqlSync(file));
if (ex.Result == FixTokenResult.ReGenerateEntity)
return Regenerate(template, replacements);
throw new InvalidOperationException("Unexcpected {0}".FormatWith(ex.Result));
}
finally
{
Console.Clear();
}
}
catch (Exception e)
{
return new SqlPreCommandSimple("-- Exception in {0}: {1}".FormatWith(template.BaseToString(), e.Message));
}
}
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:100,代码来源:WordTemplateLogic.cs
示例16: CompareLambda
protected virtual bool CompareLambda(LambdaExpression a, LambdaExpression b)
{
int n = a.Parameters.Count;
if (b.Parameters.Count != n)
return false;
for (int i = 0; i < n; i++)
{
if (a.Parameters[i].Type != b.Parameters[i].Type)
return false;
}
ScopedDictionary<ParameterExpression, ParameterExpression> save = _scope;
_scope = new ScopedDictionary<ParameterExpression, ParameterExpression>(_scope);
try
{
for (int i = 0; i < n; i++)
_scope.Add(a.Parameters[i], b.Parameters[i]);
return Compare(a.Body, b.Body);
}
finally
{
_scope = save;
}
}
开发者ID:radischevo,项目名称:Radischevo.Wahha,代码行数:26,代码来源:ExpressionComparer.cs
示例17: CompareJoin
protected virtual bool CompareJoin(JoinExpression a, JoinExpression b)
{
if (a.Join != b.Join || !this.Compare(a.Left, b.Left))
return false;
if (a.Join == JoinType.CrossApply || a.Join == JoinType.OuterApply)
{
var save = this.aliasScope;
try
{
this.aliasScope = new ScopedDictionary<TableAlias, TableAlias>(this.aliasScope);
this.MapAliases(a.Left, b.Left);
return this.Compare(a.Right, b.Right)
&& this.Compare(a.Condition, b.Condition);
}
finally
{
this.aliasScope = save;
}
}
else
{
return this.Compare(a.Right, b.Right)
&& this.Compare(a.Condition, b.Condition);
}
}
开发者ID:jogibear9988,项目名称:IQToolkit,代码行数:27,代码来源:DbExpressionComparer.cs
示例18: CompareProjection
protected virtual bool CompareProjection(ProjectionExpression a, ProjectionExpression b)
{
if (!this.Compare(a.Select, b.Select))
return false;
var save = this.aliasScope;
try
{
this.aliasScope = new ScopedDictionary<TableAlias, TableAlias>(this.aliasScope);
this.aliasScope.Add(a.Select.Alias, b.Select.Alias);
return this.Compare(a.Projector, b.Projector)
&& this.Compare(a.Aggregator, b.Aggregator)
&& a.IsSingleton == b.IsSingleton;
}
finally
{
this.aliasScope = save;
}
}
开发者ID:jogibear9988,项目名称:IQToolkit,代码行数:20,代码来源:DbExpressionComparer.cs
示例19: ExpressionComparer
protected ExpressionComparer(ScopedDictionary<ParameterExpression, ParameterExpression> parameterScope, bool exactMatch)
{
this.parameterScope = parameterScope;
this.exactMatch = exactMatch;
}
开发者ID:antonsamarsky,项目名称:expression,代码行数:5,代码来源:ExpressionComparer.cs
注:本文中的ScopedDictionary类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论