Search Results for

    Show / Hide Table of Contents
    View Source

    Class UmbracoEFCoreServiceCollectionExtensions

    Inheritance
    System.Object
    Namespace: Umbraco.Extensions
    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
    Name Description
    T
    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
    Name Description
    T
    View Source

    AddUmbracoEFCoreContext<T>(IServiceCollection, String, String, UmbracoEFCoreServiceCollectionExtensions.DefaultEFCoreOptionsAction)

    Declaration
    public static IServiceCollection AddUmbracoEFCoreContext<T>(this IServiceCollection services, string connectionString, string providerName, UmbracoEFCoreServiceCollectionExtensions.DefaultEFCoreOptionsAction defaultEFCoreOptionsAction = null)
        where T : DbContext
    Parameters
    Type Name Description
    IServiceCollection services
    System.String connectionString
    System.String providerName
    UmbracoEFCoreServiceCollectionExtensions.DefaultEFCoreOptionsAction defaultEFCoreOptionsAction
    Returns
    Type Description
    IServiceCollection
    Type Parameters
    Name Description
    T
    View Source

    AddUmbracoEFCoreContext<T>(IServiceCollection, UmbracoEFCoreServiceCollectionExtensions.DefaultEFCoreOptionsAction)

    Declaration
    public static IServiceCollection AddUmbracoEFCoreContext<T>(this IServiceCollection services, UmbracoEFCoreServiceCollectionExtensions.DefaultEFCoreOptionsAction defaultEFCoreOptionsAction = null)
        where T : DbContext
    Parameters
    Type Name Description
    IServiceCollection services
    UmbracoEFCoreServiceCollectionExtensions.DefaultEFCoreOptionsAction defaultEFCoreOptionsAction
    Returns
    Type Description
    IServiceCollection
    Type Parameters
    Name Description
    T
    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
    Remarks

    Only supports the databases normally supported in Umbraco.

    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
    • Improve this Doc
    • View Source
    In This Article
    • Methods
      • AddUmbracoDbContext<T>(IServiceCollection, Nullable<Action<DbContextOptionsBuilder>>)
      • AddUmbracoDbContext<T>(IServiceCollection, Nullable<Action<IServiceProvider, DbContextOptionsBuilder>>)
      • AddUmbracoEFCoreContext<T>(IServiceCollection, String, String, UmbracoEFCoreServiceCollectionExtensions.DefaultEFCoreOptionsAction)
      • AddUmbracoEFCoreContext<T>(IServiceCollection, UmbracoEFCoreServiceCollectionExtensions.DefaultEFCoreOptionsAction)
      • UseDatabaseProvider(DbContextOptionsBuilder, String, String)
      • UseUmbracoDatabaseProvider(DbContextOptionsBuilder, IServiceProvider)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX