本文整理汇总了C#中ModelNode.Flatten方法的典型用法代码示例。如果您正苦于以下问题:C# ModelNode.Flatten方法的具体用法?C# ModelNode.Flatten怎么用?C# ModelNode.Flatten使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelNode
的用法示例。
在下文中一共展示了ModelNode.Flatten方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckProvisionCompatibility
public override ModelProvisionCompatibilityResult CheckProvisionCompatibility(ModelNode model)
{
var result = new ModelProvisionCompatibilityResult
{
Model = model
};
var modelNodes = model.Flatten();
var rootNode = model;
foreach (var modelNode in modelNodes)
{
var def = modelNode.Value;
var defType = def.GetType();
var defResult = new ModelProvisionCompatibilityResultValue();
var attrs = (SPObjectTypeAttribute[])defType
.GetCustomAttributes(typeof(SPObjectTypeAttribute), true);
defResult.ModelNode = modelNode;
defResult.Definition = def;
if (attrs.Length > 0)
{
defResult.IsCSOMCompatible = attrs.Any(a => a.ObjectModelType == SPObjectModelType.CSOM);
defResult.IsSSOMCompatible = attrs.Any(a => a.ObjectModelType == SPObjectModelType.SSOM);
}
// temporary fix for SiteDefinition, it cannot be yet provisioned with M2 CSOM
if (def.GetType() == typeof(SiteDefinition))
{
if (modelNode.Options.RequireSelfProcessing)
{
// that's farm / web model or an attempt to provision a new site w/ M2
defResult.IsCSOMCompatible = false;
}
else
{
// SiteModel, all valid
defResult.IsCSOMCompatible = true;
}
}
// fixing up root definitions
// farm and web app model cannot be provisioned with M2
if (modelNode == rootNode)
{
if (defType == typeof(FarmDefinition)
|| defType == typeof(WebApplicationDefinition))
{
defResult.IsCSOMCompatible = false;
}
}
result.Result.Add(defResult);
}
return result;
}