ServiceCollectionExt.cs 873 B

12345678910111213141516171819202122
  1. using Microsoft.Extensions.DependencyInjection;
  2. using Quadarax.Foundation.Core.Data.Domain;
  3. using Quadarax.Foundation.Core.Data.Interface.Domain;
  4. using Quadarax.Foundation.Core.Data.Mapper;
  5. namespace Quadarax.Foundation.Core.Business.Injection.Extensions
  6. {
  7. public static class ServiceCollectionExt
  8. {
  9. public static IServiceCollection AddDataDomain(this IServiceCollection services)
  10. {
  11. services.AddScoped<IDomainContextResolver<DataDomain>, DomainContextResolver<DataDomain>>();
  12. services.AddScoped<IUnitOfWork<DataDomain>, UnitOfWorkDataDomain>();
  13. return services;
  14. }
  15. public static IServiceCollection AddMapper<TMapper>(this IServiceCollection services) where TMapper : Mapper<TMapper>, new()
  16. {
  17. return services.AddSingleton<TMapper>();
  18. }
  19. }
  20. }