ApplicationServiceRegistration.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. using MediatR;
  2. using Microsoft.Extensions.DependencyInjection;
  3. using MTWorkHR.Application.Identity;
  4. using MTWorkHR.Application.Services;
  5. using MTWorkHR.Application.Services.Interfaces;
  6. using MTWorkHR.Core.Global;
  7. using MTWorkHR.Identity.Services;
  8. using System.Reflection;
  9. namespace MTWorkHR.Application
  10. {
  11. public static class ApplicationServiceRegistration
  12. {
  13. public static IServiceCollection AddApplicationServices(this IServiceCollection services, AppSettingsConfiguration config)
  14. {
  15. services.AddSingleton(config);
  16. services.AddAutoMapper(Assembly.GetExecutingAssembly());
  17. services.AddMediatR(Assembly.GetExecutingAssembly());
  18. services.AddTransient<IAuthService, AuthService>();
  19. services.AddTransient<IUserService, UserService>();
  20. services.AddTransient<IFileService, FileService>();
  21. services.AddScoped<IProjectService, ProjectService>();
  22. services.AddScoped<IUserTaskService, UserTaskService>();
  23. return services;
  24. }
  25. }
  26. }