View Source
Class UmbracoEFCoreServiceCollectionExtensions
Inheritance
System.Object
Assembly: Umbraco.Cms.Persistence.EFCore.dll
Syntax
public static class UmbracoEFCoreServiceCollectionExtensions
Methods
View Source
AddUmbracoDbContext<T>(IServiceCollection, Nullable<Action<DbContextOptionsBuilder>>)
Adds a EFCore DbContext with all the services needed to integrate with Umbraco scopes.
Declaration
public static IServiceCollection AddUmbracoDbContext<T>(this IServiceCollection services, Action<DbContextOptionsBuilder>? optionsAction = null)
where T : DbContext
Parameters
Type |
Name |
Description |
IServiceCollection |
services |
|
System.Nullable<Action<DbContextOptionsBuilder>> |
optionsAction |
|
Returns
Type |
Description |
IServiceCollection |
|
Type Parameters
View Source
AddUmbracoDbContext<T>(IServiceCollection, Nullable<Action<IServiceProvider, DbContextOptionsBuilder>>)
Adds a EFCore DbContext with all the services needed to integrate with Umbraco scopes.
Declaration
public static IServiceCollection AddUmbracoDbContext<T>(this IServiceCollection services, Action<IServiceProvider, DbContextOptionsBuilder>? optionsAction = null)
where T : DbContext
Parameters
Type |
Name |
Description |
IServiceCollection |
services |
|
System.Nullable<Action<IServiceProvider, DbContextOptionsBuilder>> |
optionsAction |
|
Returns
Type |
Description |
IServiceCollection |
|
Type Parameters
View Source
UseDatabaseProvider(DbContextOptionsBuilder, String, String)
Sets the database provider. I.E UseSqlite or UseSqlServer based on the provider name.
Declaration
public static void UseDatabaseProvider(this DbContextOptionsBuilder builder, string providerName, string connectionString)
Parameters
Type |
Name |
Description |
DbContextOptionsBuilder |
builder |
|
System.String |
providerName |
|
System.String |
connectionString |
|
View Source
UseUmbracoDatabaseProvider(DbContextOptionsBuilder, IServiceProvider)
Sets the database provider to use based on the Umbraco connection string.
Declaration
public static void UseUmbracoDatabaseProvider(this DbContextOptionsBuilder builder, IServiceProvider serviceProvider)
Parameters
Type |
Name |
Description |
DbContextOptionsBuilder |
builder |
|
IServiceProvider |
serviceProvider |
|