ApplicationServiceRegistration.cs 944 B

123456789101112131415161718192021222324252627282930
  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. return services;
  22. }
  23. }
  24. }