Guest User

Untitled

a guest
Dec 15th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. public void ConfigureServices(IServiceCollection services)
  2. {
  3.  
  4. var mappingConfig = new MapperConfiguration(mc =>
  5. {
  6. mc.AddProfile(new Data.Configure.MappingProfile());
  7. mc.AddProfile(new Services.Configuration.MappingProfile());
  8. });
  9.  
  10. var mapper = mappingConfig.CreateMapper();
  11.  
  12. services.AddSingleton(mapper);
  13.  
  14. services.AddMvc().AddFluentValidation().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
  15. services.AddDbContext<TaskierContext>((obj) =>
  16. {
  17. obj.UseSqlServer(Configuration.GetConnectionString("Default"), opt => opt.MigrationsAssembly("Taskier.Data"));
  18. });
  19.  
  20. //Validators
  21. services.AddTransient<IValidator<CreateTaskRequest>, CreateTaskRequestValidator>();
  22.  
  23. //Services
  24. services.AddScoped<IRepoFactory, RepoFactory>();
  25. services.AddScoped<IServiceFactory, ServiceFactory>();
  26.  
  27. }
Add Comment
Please, Sign In to add comment