Class DbContextExtensions
Inheritance
System.Object
      Namespace: Umbraco.Extensions
Assembly: Umbraco.Cms.Persistence.EFCore.dll
Syntax
public static class DbContextExtensionsMethods
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 | 
|---|---|---|
| DatabaseFacade | database | The database. | 
| System.String | sql | The sql query. | 
| System.Nullable<List<System.Data.Common.DbParameter>> | parameters | The list of db parameters. | 
| System.Data.CommandType | commandType | The command type. | 
| System.Nullable<TimeSpan> | 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 | 
|---|---|---|
| DbContext | context | |
| System.String | targetMigrationId | 
Returns
| Type | Description | 
|---|---|
| Task | 
MigrateDatabaseAsync(DbContext, Type)
Declaration
public static async Task MigrateDatabaseAsync(this DbContext context, Type targetMigration)Parameters
| Type | Name | Description | 
|---|---|---|
| DbContext | context | |
| Type | targetMigration | 
Returns
| Type | Description | 
|---|---|
| Task |