View Source
  Class DatabaseBuilder
  
  Supports building and configuring the database.
 
  
  
    Inheritance
      System.Object
      
   
  
  Assembly: Umbraco.Infrastructure.dll
  Syntax
  
    public class DatabaseBuilder
   
  Constructors
  
  
    View Source
  
  
  
  
  Declaration
  
    public DatabaseBuilder(ICoreScopeProvider scopeProvider, IScopeAccessor scopeAccessor, IUmbracoDatabaseFactory databaseFactory, IRuntimeState runtimeState, ILoggerFactory loggerFactory, IKeyValueService keyValueService, IDbProviderFactoryCreator dbProviderFactoryCreator, IConfigManipulator configManipulator, IOptionsMonitor<GlobalSettings> globalSettings, IOptionsMonitor<ConnectionStrings> connectionStrings, IMigrationPlanExecutor migrationPlanExecutor, DatabaseSchemaCreatorFactory databaseSchemaCreatorFactory, IEnumerable<IDatabaseProviderMetadata> databaseProviderMetadata)
   
  Parameters
  
  
    View Source
  
  
  
  
  Declaration
  
    public DatabaseBuilder(ICoreScopeProvider scopeProvider, IScopeAccessor scopeAccessor, IUmbracoDatabaseFactory databaseFactory, IRuntimeState runtimeState, ILoggerFactory loggerFactory, IKeyValueService keyValueService, IDbProviderFactoryCreator dbProviderFactoryCreator, IConfigManipulator configManipulator, IOptionsMonitor<GlobalSettings> globalSettings, IOptionsMonitor<ConnectionStrings> connectionStrings, IMigrationPlanExecutor migrationPlanExecutor, DatabaseSchemaCreatorFactory databaseSchemaCreatorFactory, IEnumerable<IDatabaseProviderMetadata> databaseProviderMetadata, IEventAggregator aggregator)
   
  Parameters
  
  Properties
  
  
    View Source
  
  CanConnectToDatabase
  Gets a value indicating whether it is possible to connect to the configured database.
It does not necessarily mean that Umbraco is installed, nor up-to-date.
 
  
  Declaration
  
    public bool CanConnectToDatabase { get; }
   
  Property Value
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  
    View Source
  
  
  Gets a value indicating whether the database is configured. It does not necessarily
mean that it is possible to connect, nor that Umbraco is installed, nor up-to-date.
 
  
  Declaration
  
    public bool IsDatabaseConfigured { get; }
   
  Property Value
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  Methods
  
  
    View Source
  
  CanConnect(String, String)
  Verifies whether a it is possible to connect to a database.
 
  
  Declaration
  
    public bool CanConnect(string connectionString, string providerName)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        connectionString | 
         | 
      
      
        | System.String | 
        providerName | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  
    View Source
  
  
  
  
  Declaration
  
    public bool ConfigureDatabaseConnection(DatabaseModel databaseSettings, bool isTrialRun)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | DatabaseModel | 
        databaseSettings | 
         | 
      
      
        | System.Boolean | 
        isTrialRun | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  
    View Source
  
  CreateDatabase()
  
  
  Declaration
  
    public void CreateDatabase()
   
  
    View Source
  
  CreateSchemaAndData()
  Creates the database schema and inserts initial data.
 
  
  Declaration
  
    public DatabaseBuilder.Result CreateSchemaAndData()
   
  Returns
  
  Remarks
  
  
    View Source
  
  HasSomeNonDefaultUser()
  
  
  Declaration
  
    public bool HasSomeNonDefaultUser()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  
    View Source
  
  UpgradeSchemaAndData(UmbracoPlan)
  Upgrades the database schema and data by running migrations.
 
  
  Declaration
  
    public DatabaseBuilder.Result UpgradeSchemaAndData(UmbracoPlan plan)
   
  Parameters
  
  Returns
  
  Remarks
  
  
    View Source
  
  ValidateSchema()
  Validates the database schema.
 
  
  Declaration
  
    public DatabaseSchemaResult ValidateSchema()
   
  Returns