Class DbContextExtensions
Inheritance
System.Object
Namespace: Umbraco.Extensions
Assembly: Umbraco.Cms.Persistence.EFCore.dll
Syntax
public static class DbContextExtensions
Methods
View SourceExecuteScalarAsync<T>(DatabaseFacade, String, Nullable<List<DbParameter>>, CommandType, Nullable<TimeSpan>)
Executes a raw SQL query and returns the result.
Declaration
public static async Task<T> ExecuteScalarAsync<T>(this DatabaseFacade database, string sql, List<DbParameter>? parameters = null, CommandType commandType = CommandType.Text, TimeSpan? commandTimeOut = null)
Parameters
Type | Name | Description |
---|---|---|
Database |
database | The database. |
System. |
sql | The sql query. |
System. |
parameters | The list of db parameters. |
System. |
commandType | The command type. |
System. |
commandTimeOut | The amount of time to wait before the command times out. |
Returns
Type | Description |
---|---|
Task<T> | Returns an object of the given type T. |
Type Parameters
Name | Description |
---|---|
T | the type to return. |
MigrateDatabaseAsync(DbContext, String)
Declaration
public static async Task MigrateDatabaseAsync(this DbContext context, string targetMigrationId)
Parameters
Type | Name | Description |
---|---|---|
Db |
context | |
System. |
targetMigrationId |
Returns
Type | Description |
---|---|
Task |
MigrateDatabaseAsync(DbContext, Type)
Declaration
public static async Task MigrateDatabaseAsync(this DbContext context, Type targetMigration)
Parameters
Type | Name | Description |
---|---|---|
Db |
context | |
Type | targetMigration |
Returns
Type | Description |
---|---|
Task |