From e2171a923ab95ba031c08fe068a7e3ed73d0193d Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 10 Dec 2020 18:49:06 +0200 Subject: AutoMapper rework extravaganza --- API/Controllers/UserController.cs | 2 +- API/Service/UserService.cs | 4 ++-- API/Startup.cs | 15 ++++++++------- 3 files changed, 11 insertions(+), 10 deletions(-) (limited to 'API') diff --git a/API/Controllers/UserController.cs b/API/Controllers/UserController.cs index 605b138..e8a58b8 100644 --- a/API/Controllers/UserController.cs +++ b/API/Controllers/UserController.cs @@ -16,7 +16,7 @@ namespace API.Controllers { private readonly UserService _service; - public UserController(DevHiveContext context, Mapper mapper) + public UserController(DevHiveContext context, IMapper mapper) { this._service = new UserService(context, mapper); } diff --git a/API/Service/UserService.cs b/API/Service/UserService.cs index ce90d0c..c673fac 100644 --- a/API/Service/UserService.cs +++ b/API/Service/UserService.cs @@ -15,9 +15,9 @@ namespace API.Service public class UserService { private readonly DbRepository _dbRepository; - private readonly Mapper _userMapper; + private readonly IMapper _userMapper; - public UserService(DevHiveContext context, Mapper mapper) + public UserService(DevHiveContext context, IMapper mapper) { this._dbRepository = new DbRepository(context); this._userMapper = mapper; diff --git a/API/Startup.cs b/API/Startup.cs index 825c2d4..087b523 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -77,12 +77,13 @@ namespace API endpoints.MapControllers(); }); - var configuration = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - - }).CreateMapper(); + // Mapper configuration = new Mapper(new MapperConfiguration(cfg => + // { + // cfg.CreateMap(); + // cfg.CreateMap(); + // })); + + } -} + } } -- cgit v1.2.3