111 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			111 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using Core.Blueprint.Application.UsesCases.BlobStorage.Adapter;
 | |
| using Core.Blueprint.Application.UsesCases.BlobStorage.Ports;
 | |
| using Core.Blueprint.Application.UsesCases.KeyVault.Input;
 | |
| using Core.Blueprint.Application.UsesCases.KeyVault.Ports;
 | |
| using Core.Blueprint.Application.UsesCases.Mongo.Input;
 | |
| using Core.Blueprint.Application.UsesCases.Mongo.Ports;
 | |
| using Core.Blueprint.Application.UsesCases.MongoStorage.Adapter;
 | |
| 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.Blueprints;
 | |
| using Core.Cerberos.Application.UseCases.Blueprints.Validator;
 | |
| using Core.Cerberos.Application.UseCases.KeyVault;
 | |
| using Core.Cerberos.Application.UseCases.KeyVault.Validator;
 | |
| using Core.Cerberos.Application.UseCases.SQL.Validator;
 | |
| using Core.Cerberos.Application.UseCases.UserProjects;
 | |
| 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<CreateBlueprintValidator>();
 | |
|             services.AddScoped<IValidator<CreateBlueprintRequest>, CreateBlueprintValidator>();
 | |
|             services.AddScoped<IComponentHandler<CreateBlueprintRequest>, MongoHandler>();
 | |
| 
 | |
|             services.AddScoped<IComponentHandler<GetAllBlueprintsRequest>, MongoHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<GetBlueprintValidator>();
 | |
|             services.AddScoped<IValidator<GetBlueprintRequest>, GetBlueprintValidator>();
 | |
|             services.AddScoped<IComponentHandler<GetBlueprintRequest>, MongoHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<UpdateBlueprintValidator>();
 | |
|             services.AddScoped<IValidator<UpdateBlueprintRequest>, UpdateBlueprintValidator>();
 | |
|             services.AddScoped<IComponentHandler<UpdateBlueprintRequest>, MongoHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<DeleteBlueprintValidator>();
 | |
|             services.AddScoped<IValidator<DeleteBlueprintRequest>, DeleteBlueprintValidator>();
 | |
|             services.AddScoped<IComponentHandler<DeleteBlueprintRequest>, MongoHandler>();
 | |
|             #endregion
 | |
| 
 | |
|             #region SQL Services
 | |
|             services.AddScoped<ISQLPort, SQLPort>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<CreateUserProjectValidator>();
 | |
|             services.AddScoped<IValidator<CreateUserProjectRequest>, CreateUserProjectValidator>();
 | |
|             services.AddScoped<IComponentHandler<CreateUserProjectRequest>, SQLHandler>();
 | |
| 
 | |
|             services.AddScoped<IComponentHandler<GetAllUserProjectsRequest>, SQLHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<GetUserProjectValidator>();
 | |
|             services.AddScoped<IValidator<GetUserProjectRequest>, GetUserProjectValidator>();
 | |
|             services.AddScoped<IComponentHandler<GetUserProjectRequest>, SQLHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<UpdateUserProjectValidator>();
 | |
|             services.AddScoped<IValidator<UpdateUserProjectRequest>, UpdateUserProjectValidator>();
 | |
|             services.AddScoped<IComponentHandler<UpdateUserProjectRequest>, SQLHandler>();
 | |
| 
 | |
|             services.AddValidatorsFromAssemblyContaining<DeleteUserProjectValidator>();
 | |
|             services.AddScoped<IValidator<DeleteUserProjectRequest>, DeleteUserProjectValidator>();
 | |
|             services.AddScoped<IComponentHandler<DeleteUserProjectRequest>, 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;
 | |
|         }
 | |
|     }
 | |
| } | 
