113 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			113 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using Core.Blueprint.Application.UsesCases.BlobStorage.Adapter;
 | |
| using Core.Blueprint.Application.UsesCases.BlobStorage.Input;
 | |
| using Core.Blueprint.Application.UsesCases.BlobStorage.Ports;
 | |
| using Core.Blueprint.Application.UsesCases.KeyVault.Adapter;
 | |
| using Core.Blueprint.Application.UsesCases.KeyVault.Input;
 | |
| using Core.Blueprint.Application.UsesCases.KeyVault.Ports;
 | |
| using Core.Blueprint.Application.UsesCases.Mongo;
 | |
| using Core.Blueprint.Application.UsesCases.Mongo.Adapter;
 | |
| using Core.Blueprint.Application.UsesCases.Mongo.Input;
 | |
| using Core.Blueprint.Application.UsesCases.Mongo.Ports;
 | |
| using Core.Blueprint.Application.UsesCases.SQL;
 | |
| using Core.Blueprint.Application.UsesCases.SQL.Adapter;
 | |
| using Core.Blueprint.Application.UsesCases.SQL.Input;
 | |
| using Core.Blueprint.Application.UsesCases.SQL.Ports;
 | |
| using Core.Cerberos.Application.UseCases.KeyVault;
 | |
| using Core.Cerberos.Application.UseCases.KeyVault.Validator;
 | |
| using Core.Cerberos.Application.UseCases.Mongo.Validator;
 | |
| using Core.Cerberos.Application.UseCases.SQL.Validator;
 | |
| using FluentValidation;
 | |
| using Lib.Architecture.BuildingBlocks;
 | |
| 
 | |
| namespace Core.Blueprint.Service.API.Extensions
 | |
| {
 | |
|     public static class ServiceCollectionExtension
 | |
|     {
 | |
|         public static IServiceCollection AddServiceConfigurationLayer(this IServiceCollection services)
 | |
|         {
 | |
|             #region Mongo Services
 | |
|             services.AddScoped<IMongoPort, MongoPort>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<CreateSqlSampleValidator>();
 | |
|             services.AddScoped<IValidator<CreateMongoSampleRequest>, CreateMongoSampleValidator>();
 | |
|             services.AddScoped<IComponentHandler<CreateMongoSampleRequest>, MongoHandler>();
 | |
| 
 | |
|             services.AddScoped<IComponentHandler<GetAllMongoSamplesRequest>, MongoHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<GetSqlSampleValidator>();
 | |
|             services.AddScoped<IValidator<GetMongoSampleRequest>, GetMongoSampleValidator>();
 | |
|             services.AddScoped<IComponentHandler<GetMongoSampleRequest>, MongoHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<UpdateSqlSampleValidator>();
 | |
|             services.AddScoped<IValidator<UpdateMongoSampleRequest>, UpdateMongoSampleValidator>();
 | |
|             services.AddScoped<IComponentHandler<UpdateMongoSampleRequest>, MongoHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<DeleteSqlSampleValidator>();
 | |
|             services.AddScoped<IValidator<DeleteMongoSampleRequest>, DeleteMongoSampleValidator>();
 | |
|             services.AddScoped<IComponentHandler<DeleteMongoSampleRequest>, MongoHandler>();
 | |
|             #endregion
 | |
| 
 | |
|             #region SQL Services
 | |
|             services.AddScoped<ISQLPort, SQLPort>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<CreateSqlSampleValidator>();
 | |
|             services.AddScoped<IValidator<CreateSqlSampleRequest>, CreateSqlSampleValidator>();
 | |
|             services.AddScoped<IComponentHandler<CreateSqlSampleRequest>, SQLHandler>();
 | |
| 
 | |
|             services.AddScoped<IComponentHandler<GetAllSqlSamplesRequest>, SQLHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<GetSqlSampleValidator>();
 | |
|             services.AddScoped<IValidator<GetSqlSampleRequest>, GetSqlSampleValidator>();
 | |
|             services.AddScoped<IComponentHandler<GetSqlSampleRequest>, SQLHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<UpdateSqlSampleValidator>();
 | |
|             services.AddScoped<IValidator<UpdateSqlSampleRequest>, UpdateSqlSampleValidator>();
 | |
|             services.AddScoped<IComponentHandler<UpdateSqlSampleRequest>, SQLHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<DeleteSqlSampleValidator>();
 | |
|             services.AddScoped<IValidator<DeleteSqlSampleRequest>, DeleteSqlSampleValidator>();
 | |
|             services.AddScoped<IComponentHandler<DeleteSqlSampleRequest>, SQLHandler>();
 | |
|             #endregion
 | |
| 
 | |
|             #region KeyVault Services
 | |
|             services.AddScoped<IKeyVaultPort, KeyVaultPort>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<CreateSecretValidator>();
 | |
|             services.AddScoped<IValidator<CreateSecretRequest>, CreateSecretValidator>();
 | |
|             services.AddScoped<IComponentHandler<CreateSecretRequest>, KeyVaultHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<GetSecretValidator>();
 | |
|             services.AddScoped<IValidator<GetSecretRequest>, GetSecretValidator>();
 | |
|             services.AddScoped<IComponentHandler<GetSecretRequest>, KeyVaultHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<UpdateSecretValidator>();
 | |
|             services.AddScoped<IValidator<UpdateSecretRequest>, UpdateSecretValidator>();
 | |
|             services.AddScoped<IComponentHandler<UpdateSecretRequest>, KeyVaultHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<DeleteSecretValidator>();
 | |
|             services.AddScoped<IValidator<DeleteSecretRequest>, DeleteSecretValidator>();
 | |
|             services.AddScoped<IComponentHandler<DeleteSecretRequest>, KeyVaultHandler>();
 | |
|             #endregion
 | |
| 
 | |
|             #region Storage Services
 | |
|             services.AddScoped<IStoragePort, StoragePort>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<UploadBlobValidator>();
 | |
|             services.AddScoped<IValidator<UploadBlobRequest>, UploadBlobValidator>();
 | |
|             services.AddScoped<IComponentHandler<UploadBlobRequest>, StorageHandler>();
 | |
| 
 | |
|             services.AddScoped<IComponentHandler<GetBlobListRequest>, StorageHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<DownloadBlobValidator>();
 | |
|             services.AddScoped<IValidator<DownloadBlobRequest>, DownloadBlobValidator>();
 | |
|             services.AddScoped<IComponentHandler<DownloadBlobRequest>, StorageHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<DeleteBlobValidator>();
 | |
|             services.AddScoped<IValidator<DeleteBlobRequest>, DeleteBlobValidator>();
 | |
|             services.AddScoped<IComponentHandler<DeleteBlobRequest>, StorageHandler>();
 | |
|             #endregion
 | |
| 
 | |
|             return services;
 | |
|         }
 | |
|     }
 | |
| } | 
