-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New DependencyInjections for improving clean code
- Loading branch information
novru
authored and
novru
committed
May 17, 2024
1 parent
eda9da2
commit 66b0e60
Showing
5 changed files
with
73 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 1 addition & 40 deletions
41
Api/Extensions/Extension.cs → Api/Extensions/SwaggerExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
Infrastructure/Infrastructure/DependencyInjection/InfrastructureDependencyInjection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Application.Services; | ||
using Infrastructure.Services; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace Infrastructure.DependencyInjection; | ||
|
||
public static class InfrastructureDependencyInjection | ||
{ | ||
public static IServiceCollection AddInfrastructureServices(this IServiceCollection services) | ||
{ | ||
services.AddScoped<IUserService, UserService>(); | ||
|
||
services.AddScoped<IHostService, HostService>(); | ||
|
||
services.AddScoped<IAuthService, AuthService>(); | ||
|
||
// helper services | ||
|
||
services.AddScoped<IPassHashService, PassHashService>(); | ||
|
||
services.AddScoped<IJwtService, JwtService>(); | ||
|
||
services.AddScoped<IBlobService, BlobService>(); | ||
|
||
return services; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
Infrastructure/Persistence/DependencyInjection/PersistenceDependencyInjection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Application.Repositories.BookRepository; | ||
using Application.Repositories.CommentRepository; | ||
using Application.Repositories.CourseRepository; | ||
using Application.Repositories.UserRepository; | ||
using Application.Repositories; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Persistence.Repositories.BookRepository; | ||
using Persistence.Repositories.CommentRepository; | ||
using Persistence.Repositories.CourseRepository; | ||
using Persistence.Repositories.UserRepository; | ||
using Persistence.Repositories; | ||
|
||
namespace Persistence.DependencyInjection; | ||
|
||
public static class PersistenceDependencyInjection | ||
{ | ||
public static IServiceCollection AddPersistenceRepositories(this IServiceCollection services) | ||
{ | ||
services.AddScoped<IReadBookRepository, ReadBookRepository>(); | ||
services.AddScoped<IWriteBookRepository, WriteBookRepository>(); | ||
|
||
services.AddScoped<IReadUserRepository, ReadUserRepository>(); | ||
services.AddScoped<IWriteUserRepository, WriteUserRepository>(); | ||
|
||
services.AddScoped<IWriteCourseRepository, WriteCourseRepository>(); | ||
services.AddScoped<IReadCourseRepository, ReadCourseRepository>(); | ||
|
||
services.AddScoped<IReadCommentRepository, ReadCommentRepository>(); | ||
services.AddScoped<IWriteCommentRepository, WriteCommentRepository>(); | ||
|
||
services.AddScoped<IUnitOfWork, UnitOfWork>(); | ||
|
||
return services; | ||
} | ||
|
||
} |