private void DeployPrefix(SPWebApplication webApp, PrefixDefinition prefixDefinition) { var prefixes = webApp.Prefixes; var existingPrefix = GetPrefix(webApp, prefixDefinition); InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioning, Object = existingPrefix, ObjectType = typeof(SPPrefix), ObjectDefinition = prefixDefinition, ModelHost = webApp }); if (existingPrefix == null) { TraceService.Information((int)LogEventId.ModelProvisionProcessingNewObject, "Processing new prefix"); var prefixType = (SPPrefixType)Enum.Parse(typeof(SPPrefixType), prefixDefinition.PrefixType, true); existingPrefix = webApp.Prefixes.Add(prefixDefinition.Path, prefixType); } else { TraceService.Information((int)LogEventId.ModelProvisionProcessingExistingObject, "Processing existing prefix"); } InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioned, Object = existingPrefix, ObjectType = typeof(SPPrefix), ObjectDefinition = prefixDefinition, ModelHost = webApp }); }
public static ModelNode AddPrefix(this ModelNode model, PrefixDefinition definition, Action<ModelNode> action) { return model.AddDefinitionNode(definition, action); }
protected SPPrefix GetPrefix(SPWebApplication webApp, PrefixDefinition prefixDefinition) { var prefixes = webApp.Prefixes; return prefixes.FirstOrDefault(p => p.Name.ToUpper() == prefixDefinition.Path.ToUpper()); }
public static ModelNode AddPrefix(this ModelNode model, PrefixDefinition definition) { return AddPrefix(model, definition, null); }