New version
This commit is contained in:
6
Drab.LocalDb/IoC/ILocalDbConfiguration.cs
Normal file
6
Drab.LocalDb/IoC/ILocalDbConfiguration.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Drab.LocalDb.IoC;
|
||||
|
||||
public interface ILocalDbConfiguration
|
||||
{
|
||||
public string ConnectionString { get; set; }
|
||||
}
|
||||
13
Drab.LocalDb/IoC/IocLocalDbRegister.cs
Normal file
13
Drab.LocalDb/IoC/IocLocalDbRegister.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Drab.LocalDb.IoC;
|
||||
|
||||
public static class IocLocalDbRegister
|
||||
{
|
||||
public static IServiceCollection AddLocalDatabase(this IServiceCollection services, ILocalDbConfiguration localDbConfiguration)
|
||||
{
|
||||
services.AddDbContext<LocalDbContext>(cx => cx.UseSqlite(localDbConfiguration.ConnectionString));
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user