Core.Blueprint.DAL/Core.Blueprint.DAL.API/Extensions/ConfigurationExtension.cs
2025-05-18 14:38:54 -06:00

37 lines
1.3 KiB
C#

using Core.Blueprint.DAL.KeyVault.Contracts;
using Core.Blueprint.DAL.KeyVault.Services;
using Core.Blueprint.DAL.Mongo.Contracts;
using Core.Blueprint.DAL.Mongo.Entities.Collections;
using Core.Blueprint.DAL.Mongo.Service;
using Core.Blueprint.DAL.SQLServer.Context;
using Core.Blueprint.DAL.SQLServer.Contracts;
using Core.Blueprint.DAL.Storage.Contracts;
using Core.Blueprint.DAL.Storage.Service;
using Core.Blueprint.Mongo;
using Microsoft.EntityFrameworkCore;
namespace Core.Blueprint.DAL.API.Extensions
{
public static class ConfigurationExtension
{
public static IServiceCollection AddDALLayerServices(this IServiceCollection services, IConfiguration configuration)
{
//Mongo
services.AddScoped<IMongoSampleService, MongoSampleService>();
services.AddScoped<CollectionRepository<SampleCollection>>();
//SQL
services.AddDbContext<SqlServerContext>(options => options.UseSqlServer(configuration.GetConnectionString("SQLServer")));
services.AddScoped<ISqlSampleService, SqlSampleService>();
//Storage
services.AddScoped<IBlobStorageService, BlobStorageService>();
//KeyVault
services.AddScoped<IKeyVaultService, KeyVaultService>();
return services;
}
}
}