Search Results for

    Show / Hide Table of Contents

    Class DatabaseSchemaCreator

    Creates the initial database schema during install.

    Inheritance
    System.Object
    Namespace: Umbraco.Cms.Infrastructure.Migrations.Install
    Assembly: cs.temp.dll.dll
    Syntax
    public class DatabaseSchemaCreator

    Constructors

    DatabaseSchemaCreator(IUmbracoDatabase, ILogger<DatabaseSchemaCreator>, ILoggerFactory, IUmbracoVersion, IEventAggregator)

    Declaration
    [Obsolete("Please use constructor taking all parameters. Scheduled for removal in V11.")]
    public DatabaseSchemaCreator(IUmbracoDatabase database, ILogger<DatabaseSchemaCreator> logger, ILoggerFactory loggerFactory, IUmbracoVersion umbracoVersion, IEventAggregator eventAggregator)
    Parameters
    Type Name Description
    IUmbracoDatabase database
    ILogger<DatabaseSchemaCreator> logger
    ILoggerFactory loggerFactory
    IUmbracoVersion umbracoVersion
    IEventAggregator eventAggregator

    DatabaseSchemaCreator(IUmbracoDatabase, ILogger<DatabaseSchemaCreator>, ILoggerFactory, IUmbracoVersion, IEventAggregator, IOptionsMonitor<InstallDefaultDataSettings>)

    Declaration
    public DatabaseSchemaCreator(IUmbracoDatabase database, ILogger<DatabaseSchemaCreator> logger, ILoggerFactory loggerFactory, IUmbracoVersion umbracoVersion, IEventAggregator eventAggregator, IOptionsMonitor<InstallDefaultDataSettings> defaultDataCreationSettings)
    Parameters
    Type Name Description
    IUmbracoDatabase database
    ILogger<DatabaseSchemaCreator> logger
    ILoggerFactory loggerFactory
    IUmbracoVersion umbracoVersion
    IEventAggregator eventAggregator
    IOptionsMonitor<InstallDefaultDataSettings> defaultDataCreationSettings

    Methods

    DropTable(String)

    Drops the table for the specified T.

    Declaration
    public void DropTable(string tableName)
    Parameters
    Type Name Description
    System.String tableName
    Remarks

    If T has been decorated with an , the name from that attribute will be used for the table name. If the attribute is not present, the name T will be used instead.

    Examples
    schemaHelper.DropTable<MyDto>);

    InitializeDatabaseSchema()

    Initializes the database by creating the umbraco db schema.

    Declaration
    public void InitializeDatabaseSchema()
    Remarks

    This needs to execute as part of a transaction.

    TableExists(String)

    Returns whether a table with the specified tableName exists in the database.

    Declaration
    public bool TableExists(string tableName)
    Parameters
    Type Name Description
    System.String tableName

    The name of the table.

    Returns
    Type Description
    System.Boolean

    true if the table exists; otherwise false.

    Examples
    if (schemaHelper.TableExist("MyTable"))
    {
    // do something when the table exists
    }

    TableExists<T>()

    Returns whether the table for the specified T exists in the database.

    Declaration
    public bool TableExists<T>()
    Returns
    Type Description
    System.Boolean

    true if the table exists; otherwise false.

    Type Parameters
    Name Description
    T

    The type representing the DTO/table.

    Remarks

    If T has been decorated with an , the name from that attribute will be used for the table name. If the attribute is not present, the name T will be used instead.

    Examples
    if (schemaHelper.TableExist<MyDto>)
    {
    // do something when the table exists
    }
    In This Article
    • Constructors
      • DatabaseSchemaCreator(IUmbracoDatabase, ILogger<DatabaseSchemaCreator>, ILoggerFactory, IUmbracoVersion, IEventAggregator)
      • DatabaseSchemaCreator(IUmbracoDatabase, ILogger<DatabaseSchemaCreator>, ILoggerFactory, IUmbracoVersion, IEventAggregator, IOptionsMonitor<InstallDefaultDataSettings>)
    • Methods
      • DropTable(String)
      • InitializeDatabaseSchema()
      • TableExists(String)
      • TableExists<T>()
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX