本文整理汇总了C#中Core.TryGetControllerTree方法的典型用法代码示例。如果您正苦于以下问题:C# Core.TryGetControllerTree方法的具体用法?C# Core.TryGetControllerTree怎么用?C# Core.TryGetControllerTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core.TryGetControllerTree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLegacyTreeForLegacyServices
internal static BaseTree GetLegacyTreeForLegacyServices(Core.Models.ApplicationTree appTree)
{
if (appTree == null) throw new ArgumentNullException("appTree");
BaseTree tree;
var controllerAttempt = appTree.TryGetControllerTree();
if (controllerAttempt.Success)
{
var legacyAtt = controllerAttempt.Result.GetCustomAttribute<LegacyBaseTreeAttribute>(false);
if (legacyAtt == null)
{
LogHelper.Warn<LegacyTreeDataConverter>("Cannot render tree: " + appTree.Alias + ". Cannot render a " + typeof(TreeController) + " tree type with the legacy web services unless attributed with " + typeof(LegacyBaseTreeAttribute));
return null;
}
var treeDef = new TreeDefinition(
legacyAtt.BaseTreeType,
new ApplicationTree(false, true, (byte)appTree.SortOrder, appTree.ApplicationAlias, appTree.Alias, appTree.Title, appTree.IconClosed, appTree.IconOpened, "", legacyAtt.BaseTreeType.GetFullNameWithAssembly(), ""),
new Application(appTree.Alias, appTree.Alias, "", 0));
tree = treeDef.CreateInstance();
tree.TreeAlias = appTree.Alias;
}
else
{
//get the tree that we need to render
var treeDef = TreeDefinitionCollection.Instance.FindTree(appTree.Alias);
if (treeDef == null)
{
return null;
}
tree = treeDef.CreateInstance();
}
return tree;
}