SqliteServiceCollectionExtensions SqliteServiceCollectionExtensions Class

SQLite specific extension methods for .

Syntax

Declaration

public static class SqliteServiceCollectionExtensionsPublic Module SqliteServiceCollectionExtensions

Inheritance Hierarchy

  • System.Object
    System.Object
  • SqliteServiceCollectionExtensions
    SqliteServiceCollectionExtensions

Inherited Members

ToString(),
ToString(),
Equals(Object),
Equals(Object),
Equals(Object, Object),
Equals(Object, Object),
ReferenceEquals(Object, Object),
ReferenceEquals(Object, Object),
GetHashCode(),
GetHashCode(),
GetType(),
GetType(),
MemberwiseClone()
MemberwiseClone()

Methods summary

Adds the services required by the SQLite database provider for Entity Framework to an . You use this method when using dependency injection in your application, such as with ASP.NET. For more information on setting up dependency injection, see http://go.microsoft.com/fwlink/?LinkId=526890.

You only need to use this functionality when you want Entity Framework to resolve the services it uses from an external dependency injection container. If you are not using an external dependency injection container, Entity Framework will take care of creating the services it requires.

Methods

  • AddEntityFrameworkSqlite(IServiceCollection)
    AddEntityFrameworkSqlite(IServiceCollection)

    Adds the services required by the SQLite database provider for Entity Framework to an . You use this method when using dependency injection in your application, such as with ASP.NET. For more information on setting up dependency injection, see http://go.microsoft.com/fwlink/?LinkId=526890.

    You only need to use this functionality when you want Entity Framework to resolve the services it uses from an external dependency injection container. If you are not using an external dependency injection container, Entity Framework will take care of creating the services it requires.

    public static IServiceCollection AddEntityFrameworkSqlite(this IServiceCollection services)<ExtensionAttribute>
    Public Shared Function AddEntityFrameworkSqlite(services As IServiceCollection) As IServiceCollection

    Parameters

    • services
      IServiceCollection
      IServiceCollection

      The to add services to.

    Returns

    • IServiceCollection
      IServiceCollection

      The same service collection so that multiple calls can be chained.

    Example

         public void ConfigureServices(IServiceCollection services)
         {
             var connectionString = "connection string to database";
    
             services
                 .AddEntityFrameworkSqlite()
                 .AddDbContext<MyContext>((serviceProvider, options) =>
                     options.UseSqlite(connectionString)
                            .UseInternalServiceProvider(serviceProvider));
         }

Details

Assembly

Microsoft.EntityFrameworkCore.Sqlite.dll