Advertisement
Guest User

Untitled

a guest
Feb 1st, 2024
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. using AutoMapper;
  2. using Contracts;
  3. using Entities;
  4. using Microsoft.AspNetCore.Identity;
  5. using Microsoft.Extensions.Configuration;
  6. using Service.Contracts;
  7.  
  8.  
  9. namespace Service;
  10.  
  11. public sealed class ServiceManager : IServiceManager
  12. {
  13. private readonly Lazy<IBookService> _bookService;
  14. private readonly Lazy<IPageService> _pageService;
  15. private readonly Lazy<INoteEntityService> _noteEntityService;
  16. private readonly Lazy<IAuthenticationService> _authenticationService;
  17. private readonly Lazy<IPostService> _postService;
  18. private readonly Lazy<ICommentService> _commentService;
  19. private readonly Lazy<IUserRelationshipService> _userRelationshipService;
  20. private readonly Lazy<ILikeService> _likeService;
  21. private readonly UserManager<User> _userManager;
  22.  
  23. public ServiceManager(IRepositoryManager repositoryManager, IMapper mapper, UserManager<User> userManager, IConfiguration configuration)
  24. {
  25. _bookService = new Lazy<IBookService>(() => new BookService(repositoryManager, mapper));
  26. _pageService = new Lazy<IPageService>(() => new PageService(repositoryManager, mapper));
  27. _noteEntityService = new Lazy<INoteEntityService>(() => new NoteEntityService(repositoryManager,mapper));
  28. _postService = new Lazy<IPostService>(() => new PostService(repositoryManager, mapper));
  29. _commentService = new Lazy<ICommentService>(() => new CommentService(repositoryManager, mapper));
  30. _likeService = new Lazy<ILikeService>(() => new LikeService(repositoryManager, mapper));
  31. _userRelationshipService = new Lazy<IUserRelationshipService>(() => new UserRelationshipService(repositoryManager, mapper));
  32. _authenticationService = new Lazy<IAuthenticationService>(() => new AuthenticationService(mapper, userManager, configuration));
  33. _userManager = userManager;
  34. }
  35.  
  36. public IPageService PageService => _pageService.Value;
  37. public IBookService BookService => _bookService.Value;
  38. public INoteEntityService NoteEntityServíce => _noteEntityService.Value;
  39. public IPostService PostService => _postService.Value;
  40. public ICommentService CommentService => _commentService.Value;
  41. public ILikeService LikeService => _likeService.Value;
  42. public IUserRelationshipService UserRelationshipService => _userRelationshipService.Value;
  43. public IAuthenticationService AuthenticationService => _authenticationService.Value;
  44. public UserManager<User> UserService =>_userManager;
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement