//[SampleMetadataTag(Name = BuiltInTagNames.SampleHidden)] public void CanDeploySimpleContentDatabaseDefinition() { var contentDb1 = new ContentDatabaseDefinition { ServerName = "localhost", DbName = "intranet_content_db1" }; var contentDb2 = new ContentDatabaseDefinition { ServerName = "localhost", DbName = "intranet_content_db2" }; var model = SPMeta2Model.NewWebApplicationModel(webApp => { webApp .AddContentDatabase(contentDb1) .AddContentDatabase(contentDb2); }); DeployModel(model); }
public static ModelNode AddContentDatabase(this ModelNode model, ContentDatabaseDefinition definition, Action <ModelNode> action) { return(model.AddDefinitionNode(definition, action)); }
public static ModelNode AddContentDatabase(this ModelNode model, ContentDatabaseDefinition definition) { return(AddContentDatabase(model, definition, null)); }
private void DeployContentDatabase(WebApplicationModelHost modelHost, SPWebApplication webApp, ContentDatabaseDefinition definition) { var existringDb = GetCurrentContentDatabase(webApp, definition); InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioning, Object = existringDb, ObjectType = typeof(SPContentDatabase), ObjectDefinition = definition, ModelHost = modelHost }); if (existringDb == null) { existringDb = webApp.ContentDatabases.Add( definition.ServerName, definition.DbName, definition.UserName, definition.UserPassword, definition.WarningSiteCollectionNumber, definition.MaximumSiteCollectionNumber, definition.Status); existringDb.Update(true); } InvokeOnModelEvent(this, new ModelEventArgs { CurrentModelNode = null, Model = null, EventType = ModelEventType.OnProvisioned, Object = existringDb, ObjectType = typeof(SPContentDatabase), ObjectDefinition = definition, ModelHost = modelHost }); }
protected SPContentDatabase GetCurrentContentDatabase(SPWebApplication webApp, ContentDatabaseDefinition definition) { var dbName = definition.DbName.ToUpper(); return(webApp.ContentDatabases.OfType <SPContentDatabase>() .FirstOrDefault(d => !string.IsNullOrEmpty(d.Name) && d.Name.ToUpper() == dbName)); }
public static TModelNode AddContentDatabase <TModelNode>(this TModelNode model, ContentDatabaseDefinition definition, Action <ContentDatabaseModelNode> action) where TModelNode : ModelNode, IWebApplicationModelNode, new() { return(model.AddTypedDefinitionNode(definition, action)); }
public static TModelNode AddContentDatabase <TModelNode>(this TModelNode model, ContentDatabaseDefinition definition) where TModelNode : ModelNode, IWebApplicationModelNode, new() { return(AddContentDatabase(model, definition, null)); }