27 lines
966 B
C#
27 lines
966 B
C#
using IdentityServer.Domain.Data.DbContexts;
|
|
using IdentityServer.Domain.Data.Repositories;
|
|
using IdentityServer.Domain.Repositories;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace IdentityServer.Domain.Data
|
|
{
|
|
public static class DependencyInjectionExtensions
|
|
{
|
|
public static void AddDataAccess(this IServiceCollection services)
|
|
{
|
|
services.AddScoped<IIdentityRepository, IdentityRepository>();
|
|
|
|
services
|
|
.AddDbContextPool<IdentityDbContext>(
|
|
(serviceProvider, options) =>
|
|
{
|
|
var configuration = serviceProvider.GetService<IConfiguration>();
|
|
var connectionString = configuration.GetConnectionString("DatabaseConnection");
|
|
options.UseSqlServer(connectionString);
|
|
});
|
|
}
|
|
}
|
|
}
|