Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IUmbracoDatabase

    Defines an abstraction for interacting with the Umbraco database, providing methods for persistence and data access operations.

    Namespace: Umbraco.Cms.Infrastructure.Persistence
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    public interface IUmbracoDatabase : IDatabase, IAsyncDatabase, IAsyncQueryDatabase, IAsyncBaseDatabase, IBaseCommonDatabase, IDatabaseConfig, IDatabaseQuery, IBaseDatabase

    Properties

    View Source

    EnableSqlCount

    Gets or sets a value indicating whether SQL count queries are enabled for this database instance. When enabled, the database will track and expose the number of executed SQL queries.

    Declaration
    bool EnableSqlCount { get; set; }
    Property Value
    Type Description
    bool
    View Source

    InTransaction

    Gets a value indicating whether the database is currently in a transaction.

    Declaration
    bool InTransaction { get; }
    Property Value
    Type Description
    bool
    View Source

    InstanceId

    Gets the database instance unique identifier as a string.

    Declaration
    string InstanceId { get; }
    Property Value
    Type Description
    string
    Remarks

    UmbracoDatabase returns the first eight digits of its unique Guid and, in some debug mode, the underlying database connection identifier (if any).

    View Source

    SqlContext

    Gets the Sql context.

    Declaration
    ISqlContext SqlContext { get; }
    Property Value
    Type Description
    ISqlContext
    View Source

    SqlCount

    Gets the total number of SQL queries that have been executed by this database instance.

    Declaration
    int SqlCount { get; }
    Property Value
    Type Description
    int

    Methods

    View Source

    BulkInsertRecords<T>(IEnumerable<T>)

    Inserts a collection of records into the database in a single bulk operation.

    Declaration
    int BulkInsertRecords<T>(IEnumerable<T> records)
    Parameters
    Type Name Description
    IEnumerable<T> records

    The collection of records to insert.

    Returns
    Type Description
    int

    The number of records successfully inserted.

    Type Parameters
    Name Description
    T

    The type of the records to insert.

    View Source

    ExecuteNonQuery(DbCommand)

    Executes a non-query command (such as INSERT, UPDATE, or DELETE) against the database.

    Declaration
    int ExecuteNonQuery(DbCommand command)
    Parameters
    Type Name Description
    DbCommand command

    The System.Data.Common.DbCommand to execute.

    Returns
    Type Description
    int

    The number of rows affected by the command.

    View Source

    IsUmbracoInstalled()

    Gets a value indicating whether Umbraco is installed.

    Declaration
    bool IsUmbracoInstalled()
    Returns
    Type Description
    bool

    True if Umbraco is installed; otherwise, false.

    View Source

    ValidateSchema()

    Checks the current database schema against the expected schema for Umbraco, identifying any discrepancies or issues.

    Declaration
    DatabaseSchemaResult ValidateSchema()
    Returns
    Type Description
    DatabaseSchemaResult

    A DatabaseSchemaResult containing details about the validation outcome, including any missing or invalid schema elements.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX