本文整理汇总了C#中ModelNode.GetChildModels方法的典型用法代码示例。如果您正苦于以下问题:C# ModelNode.GetChildModels方法的具体用法?C# ModelNode.GetChildModels怎么用?C# ModelNode.GetChildModels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelNode
的用法示例。
在下文中一共展示了ModelNode.GetChildModels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Traverse
public override void Traverse(object modelHost, ModelNode modelNode)
{
try
{
var modelDefinition = modelNode.Value as DefinitionBase;
var modelHandler = OnModelHandlerResolve(modelNode);
TraceService.VerboseFormat((int)LogEventId.ModelProcessing, "Raising OnModelFullyProcessing for model: [{0}].", modelNode);
if (OnModelFullyProcessing != null)
OnModelFullyProcessing(modelNode);
TraceService.VerboseFormat((int)LogEventId.ModelProcessing, "Raising OnModelProcessing for model: [{0}].", modelNode);
if (OnModelProcessing != null)
OnModelProcessing(modelNode);
//var requireselfProcessing = modelDefinition.RequireSelfProcessing || modelNode.Options.RequireSelfProcessing;
var requireselfProcessing = modelNode.Options.RequireSelfProcessing;
TraceService.InformationFormat((int)LogEventId.ModelProcessing, "Deploying model [{0}] RSP: [{1}] : [{2}].",
new[] { modelNode.Value.GetType().Name, requireselfProcessing.ToString(), modelNode.Value.ToString() });
if (requireselfProcessing)
{
modelHandler.DeployModel(modelHost, modelNode.Value);
}
TraceService.VerboseFormat((int)LogEventId.ModelProcessing, "Raising OnModelProcessed for model: [{0}].", modelNode);
if (OnModelProcessed != null)
OnModelProcessed(modelNode);
var childModelTypes = GetSortedChildModelTypes(modelNode);
foreach (var childModelType in childModelTypes)
{
TraceService.VerboseFormat((int)LogEventId.ModelProcessing, "Starting processing child models of type: [{0}].", new object[] { childModelType.Key });
var childModels = modelNode.GetChildModels(childModelType.Key).ToList();
ModelWeighService.SortChildModelNodes(modelNode, childModels);
TraceService.VerboseFormat((int)LogEventId.ModelProcessing, "Found [{0}] models of type: [{1}].", new object[] { childModels.Count(), childModelType.Key });
TraceService.VerboseFormat((int)LogEventId.ModelProcessing, "Raising OnChildModelsProcessing of type: [{0}].", new object[] { childModelType.Key });
if (OnChildModelsProcessing != null)
OnChildModelsProcessing(modelNode, childModelType.Key, childModels);
foreach (var childModel in childModels)
{
TraceService.VerboseFormat((int)LogEventId.ModelProcessing, "Starting resolving model host of type: [{0}].", new object[] { childModelType.Key });
modelHandler.WithResolvingModelHost(new ModelHostResolveContext
{
ModelHost = modelHost,
Model = modelDefinition,
ChildModelType = childModelType.Key,
ModelNode = modelNode,
Action = childModelHost =>
{
Traverse(childModelHost, childModel);
}
});
TraceService.VerboseFormat((int)LogEventId.ModelProcessing, "Finishing resolving model host of type: [{0}].", new object[] { childModelType.Key });
}
TraceService.VerboseFormat((int)LogEventId.ModelProcessing, "Raising OnChildModelsProcessed of type: [{0}].", new object[] { childModelType.Key });
if (OnChildModelsProcessed != null)
OnChildModelsProcessed(modelNode, childModelType.Key, childModels);
TraceService.VerboseFormat((int)LogEventId.ModelProcessing, "Finishing processing child models of type: [{0}].", new object[] { childModelType.Key });
}
TraceService.VerboseFormat((int)LogEventId.ModelProcessing, "Raising OnModelFullyProcessed for model: [{0}].", modelNode);
if (OnModelFullyProcessed != null)
OnModelFullyProcessed(modelNode);
}
catch (Exception e)
{
if (e is SPMeta2ModelDeploymentException)
throw;
throw new SPMeta2ModelDeploymentException("There was an error while provisioning definition. Check ModelNode prop.", e)
{
ModelNode = modelNode,
};
}
}