31 lines
856 B
C#
31 lines
856 B
C#
|
|
|
|
using Hushian.Application.Contracts.Persistence;
|
|
using Hushian.Persistence.Repositories;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using System.Reflection;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Hushian.Persistence
|
|
{
|
|
public static class PersistenceServicesRegistration
|
|
{
|
|
public static IServiceCollection ConfigurePersistenceServices(this IServiceCollection services,
|
|
IConfiguration configuration)
|
|
{
|
|
services.AddDbContext<HushianDbContext>(options =>
|
|
{
|
|
options.UseSqlServer(configuration
|
|
.GetConnectionString("MainConnectionString"));
|
|
});
|
|
services.AddScoped(typeof(IGenericRepository<>), typeof(GenericRepository<>));
|
|
|
|
|
|
return services;
|
|
}
|
|
|
|
|
|
}
|
|
}
|