Class UmbracoDatabase
Extends NPoco Database for Umbraco.
Inheritance
System.Object
Assembly: cs.temp.dll.dll
Syntax
public class UmbracoDatabase : Database, IUmbracoDatabase
Constructors
UmbracoDatabase(String, ISqlContext, DbProviderFactory, ILogger<UmbracoDatabase>, IBulkSqlInsertProvider, DatabaseSchemaCreatorFactory, RetryPolicy, RetryPolicy, IEnumerable<IMapper>)
Declaration
public UmbracoDatabase(string connectionString, ISqlContext sqlContext, DbProviderFactory provider, ILogger<UmbracoDatabase> logger, IBulkSqlInsertProvider bulkSqlInsertProvider, DatabaseSchemaCreatorFactory databaseSchemaCreatorFactory, RetryPolicy connectionRetryPolicy = null, RetryPolicy commandRetryPolicy = null, IEnumerable<IMapper> mapperCollection = null)
Parameters
Type |
Name |
Description |
System.String |
connectionString |
|
ISqlContext |
sqlContext |
|
DbProviderFactory |
provider |
|
ILogger<UmbracoDatabase> |
logger |
|
IBulkSqlInsertProvider |
bulkSqlInsertProvider |
|
DatabaseSchemaCreatorFactory |
databaseSchemaCreatorFactory |
|
RetryPolicy |
connectionRetryPolicy |
|
RetryPolicy |
commandRetryPolicy |
|
System.Collections.Generic.IEnumerable<IMapper> |
mapperCollection |
|
Properties
EnableSqlCount
Gets or sets a value indicating whether to count all executed Sql statements.
Declaration
public bool EnableSqlCount { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
InstanceId
Gets the database instance unique identifier as a string.
Declaration
public string InstanceId { get; }
Property Value
Type |
Description |
System.String |
|
InTransaction
Gets a value indicating whether the database is currently in a transaction.
Declaration
public bool InTransaction { get; }
Property Value
Type |
Description |
System.Boolean |
|
SqlContext
Declaration
public ISqlContext SqlContext { get; }
Property Value
SqlCount
Gets the count of all executed Sql statements.
Declaration
public int SqlCount { get; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
BulkInsertRecords<T>(IEnumerable<T>)
Declaration
public int BulkInsertRecords<T>(IEnumerable<T> records)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<T> |
records |
|
Returns
Type |
Description |
System.Int32 |
|
Type Parameters
CreateCommand(DbConnection, CommandType, String, Object[])
Declaration
public override DbCommand CreateCommand(DbConnection connection, CommandType commandType, string sql, params object[] args)
Parameters
Type |
Name |
Description |
DbConnection |
connection |
|
CommandType |
commandType |
|
System.String |
sql |
|
System.Object[] |
args |
|
Returns
Type |
Description |
DbCommand |
|
IsUmbracoInstalled()
Returns true if Umbraco database tables are detected to be installed
Declaration
public bool IsUmbracoInstalled()
Returns
Type |
Description |
System.Boolean |
|
OnAbortTransaction()
Declaration
protected override void OnAbortTransaction()
OnBeginTransaction()
Declaration
protected override void OnBeginTransaction()
OnCompleteTransaction()
Declaration
protected override void OnCompleteTransaction()
OnConnectionOpened(DbConnection)
Declaration
protected override DbConnection OnConnectionOpened(DbConnection connection)
Parameters
Type |
Name |
Description |
DbConnection |
connection |
|
Returns
Type |
Description |
DbConnection |
|
OnException(Exception)
Declaration
protected override void OnException(Exception ex)
Parameters
Type |
Name |
Description |
System.Exception |
ex |
|
OnExecutedCommand(DbCommand)
Declaration
protected override void OnExecutedCommand(DbCommand cmd)
Parameters
Type |
Name |
Description |
DbCommand |
cmd |
|
OnExecutingCommand(DbCommand)
Declaration
protected override void OnExecutingCommand(DbCommand cmd)
Parameters
Type |
Name |
Description |
DbCommand |
cmd |
|
ValidateSchema()
Returns the for the database
Declaration
public DatabaseSchemaResult ValidateSchema()
Returns
Type |
Description |
DatabaseSchemaResult |
|