本文整理汇总了C#中ModelNode类的典型用法代码示例。如果您正苦于以下问题:C# ModelNode类的具体用法?C# ModelNode怎么用?C# ModelNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelNode类属于命名空间,在下文中一共展示了ModelNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FileDeployer
public FileDeployer(ModelNode site, ModelNode web, ListDefinition rootNode, string sourcePath)
{
Site = site;
Web = web;
RootNode = rootNode;
SourcePath = sourcePath;
}
示例2: GenerateTermsTree
protected void GenerateTermsTree(ModelNode termSetOrTermNode, int deep, bool cleanGuid)
{
if (deep == 0)
return;
if (termSetOrTermNode is TaxonomyTermModelNode)
{
(termSetOrTermNode as TaxonomyTermModelNode).AddRandomTerm(term =>
{
var termDef = term.Value as TaxonomyTermDefinition;
termDef.Name = string.Format("InvertedLevel_{0}_{1}", deep, termDef.Name);
if (cleanGuid)
termDef.Id = null;
GenerateTermsTree(term, --deep, cleanGuid);
});
}
else if (termSetOrTermNode is TaxonomyTermSetModelNode)
{
(termSetOrTermNode as TaxonomyTermSetModelNode).AddRandomTerm(term =>
{
var termDef = term.Value as TaxonomyTermDefinition;
termDef.Name = string.Format("InvertedLevel_{0}_{1}", deep, termDef.Name);
if (cleanGuid)
termDef.Id = null;
GenerateTermsTree(term, --deep, cleanGuid);
});
}
}
示例3: GenerateNodesCore
protected override void GenerateNodesCore(ModelNode node)
{
if (!Debugger.IsAttached || !AurumMenuModule.GenerateDefaultMenus)
{
return;
}
IModelMenus modelMenus = (IModelMenus)node;
IModelGroups groups = node.Root.Application.Aurum().AurumLists().Groups;
foreach (IModelNavigationItem current in ((IModelApplicationNavigationItems)node.Root.Application).NavigationItems.Items)
{
if (modelMenus.GetNode(current.Id) == null)
{
IModelMenu modelMenu = modelMenus.AddNode<IModelMenu>(current.Id);
modelMenu.Caption = current.Caption;
modelMenu.Group = groups["Admin"];
foreach (IModelNavigationItem current2 in current.Items)
{
if (current2.Visible)
{
IModelMenuViewItem modelMenuViewItem = modelMenu.AddNode<IModelMenuViewItem>(current2.Id);
modelMenuViewItem.View = current2.View;
modelMenuViewItem.ImageName = current2.ImageName;
modelMenuViewItem.ObjectKey = current2.ObjectKey;
}
}
}
}
}
示例4: DeployModel
public override void DeployModel(ModelHostBase modelHost, ModelNode model)
{
if (!(modelHost is CSOMModelHostBase))
throw new ArgumentException("model host for CSOM needs to be inherited from CSOMModelHostBase");
base.DeployModel(modelHost, model);
}
示例5: LoadModuleFilesFromLocalFolder
/// <summary>
/// Reads the giving directory and populates the node with folders/files structure
/// </summary>
/// <param name="hostNode"></param>
/// <param name="folderPath"></param>
internal static void LoadModuleFilesFromLocalFolder(ModelNode hostNode, string folderPath)
{
var files = Directory.GetFiles(folderPath);
var folders = Directory.GetDirectories(folderPath);
foreach (var file in files)
{
hostNode.AddDefinitionNode(new ModuleFileDefinition
{
Content = File.ReadAllBytes(file),
FileName = Path.GetFileName(file),
Overwrite = true
});
}
foreach (var subFolder in folders)
{
var subFolderPath = subFolder;
var folderDef = new FolderDefinition
{
Name = Path.GetFileName(subFolderPath)
};
hostNode.AddDefinitionNode(folderDef, folderNode => LoadModuleFilesFromLocalFolder(folderNode, subFolderPath));
}
}
示例6: GenerateNodesCore
protected override void GenerateNodesCore(ModelNode node) {
node.AddNode<IModelFilterDataStoreSystemTable>("SecurityRole");
node.AddNode<IModelFilterDataStoreSystemTable>("SecurityUser");
node.AddNode<IModelFilterDataStoreSystemTable>("PropertyBag");
node.AddNode<IModelFilterDataStoreSystemTable>("PropertyBagDescriptor");
node.AddNode<IModelFilterDataStoreSystemTable>("PropertyDescriptor");
node.AddNode<IModelFilterDataStoreSystemTable>("PropertyDescriptorPropertyDescriptors_PropertyBagDescriptorPropertyBags");
node.AddNode<IModelFilterDataStoreSystemTable>("PropertyValue");
node.AddNode<IModelFilterDataStoreSystemTable>("ServerPrefix");
node.AddNode<IModelFilterDataStoreSystemTable>("XpoSequencer");
node.AddNode<IModelFilterDataStoreSystemTable>("XpoServerId");
node.AddNode<IModelFilterDataStoreSystemTable>("AuditDataItemPersistent");
node.AddNode<IModelFilterDataStoreSystemTable>("AuditedObjectWeakReference");
node.AddNode<IModelFilterDataStoreSystemTable>("XPWeakReference");
node.AddNode<IModelFilterDataStoreSystemTable>("ModuleInfo");
node.AddNode<IModelFilterDataStoreSystemTable>("User");
node.AddNode<IModelFilterDataStoreSystemTable>("SimpleUser");
node.AddNode<IModelFilterDataStoreSystemTable>("Party");
node.AddNode<IModelFilterDataStoreSystemTable>("Person");
node.AddNode<IModelFilterDataStoreSystemTable>("Role");
node.AddNode<IModelFilterDataStoreSystemTable>("RoleBase");
node.AddNode<IModelFilterDataStoreSystemTable>("PersistentPermission");
node.AddNode<IModelFilterDataStoreSystemTable>("UserUsers_RoleRoles");
node.AddNode<IModelFilterDataStoreSystemTable>("XPObjectType");
node.AddNode<IModelFilterDataStoreSystemTable>("ModelDifferenceObject");
node.AddNode<IModelFilterDataStoreSystemTable>("AspectObject");
node.AddNode<IModelFilterDataStoreSystemTable>("PersistentApplication");
node.AddNode<IModelFilterDataStoreSystemTable>("RoleModelDifferenceObject");
node.AddNode<IModelFilterDataStoreSystemTable>("UserModelDifferenceObject");
node.AddNode<IModelFilterDataStoreSystemTable>("RoleRoles_RoleModelDifferenceObjectRoleModelDifferenceObjects");
node.AddNode<IModelFilterDataStoreSystemTable>("UserUsers_UserModelDifferenceObjectUserModelDifferenceObjects");
}
示例7: Calculate
public object Calculate(ModelNode node, string propertyName) {
var modelClass = ((IModelObjectView)node.Parent).ModelClass;
var friendlyKeyProperty = modelClass.FriendlyKeyProperty;
return friendlyKeyProperty != null
? modelClass.FindMember(friendlyKeyProperty).Name
: (modelClass.KeyProperty != null ? modelClass.FindMember(modelClass.KeyProperty).Name : null);
}
示例8: RetractModel
public override void RetractModel(ModelHostBase modelHost, ModelNode model)
{
if (!(modelHost is SSOMModelHostBase))
throw new ArgumentException("model host for SSOM needs to be inherited from SSOMModelHostBase.");
base.RetractModel(modelHost, model);
}
示例9: NewModel_Click
void NewModel_Click(object sender, EventArgs args)
{
ModelNode child = new ModelNode();
child.Text = child.Name = Guid.NewGuid().ToString();
child.ModelType = ModelNode.SourceType.FromCustom;
this.Children.Add(child);
}
示例10: 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;
}
示例11: DeployWebModel
public override void DeployWebModel(ModelNode model)
{
WithSSOMContext((site, web) =>
{
_provisionService.DeployModel(WebModelHost.FromWeb(web), model);
_validationService.DeployModel(WebModelHost.FromWeb(web), model);
});
}
示例12: DeployWebModelAsCSOM
protected void DeployWebModelAsCSOM(ModelNode model)
{
using (var clientContext = new ClientContext(SampleConsts.CSOM_SiteUrl))
{
var csomProvisionService = new CSOMProvisionService();
csomProvisionService.DeployModel(SPMeta2.CSOM.ModelHosts.WebModelHost.FromClientContext(clientContext), model);
}
}
示例13: DeploySiteModelAsSSOM
protected void DeploySiteModelAsSSOM(ModelNode model)
{
using (var site = new SPSite(SampleConsts.SSOM_SiteUrl))
{
var ssomProvisionService = new SSOMProvisionService();
ssomProvisionService.DeployModel(SPMeta2.SSOM.ModelHosts.SiteModelHost.FromSite(site), model);
}
}
示例14: DeployModel
public override void DeployModel(ModelHostBase modelHost, ModelNode model)
{
// before model provision
if (IsRegisteredModel(model))
{
AttachToOnProvisionedEvents(model);
CalculateIncrementalModel(model);
}
}
示例15: DeployListModel
public static void DeployListModel(this SSOMProvisionService modelHost, SPList list, ModelNode model)
{
var listHost = ModelHostBase.Inherit<ListModelHost>(WebModelHost.FromWeb(list.ParentWeb), h =>
{
h.HostList = list;
});
modelHost.DeployModel(listHost, model);
}