Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using AutoMapper;
- using Contracts;
- using Entities;
- using Microsoft.AspNetCore.Identity;
- using Microsoft.Extensions.Configuration;
- using Service.Contracts;
- namespace Service;
- public sealed class ServiceManager : IServiceManager
- {
- private readonly Lazy<IBookService> _bookService;
- private readonly Lazy<IPageService> _pageService;
- private readonly Lazy<INoteEntityService> _noteEntityService;
- private readonly Lazy<IAuthenticationService> _authenticationService;
- private readonly Lazy<IPostService> _postService;
- private readonly Lazy<ICommentService> _commentService;
- private readonly Lazy<IUserRelationshipService> _userRelationshipService;
- private readonly Lazy<ILikeService> _likeService;
- private readonly UserManager<User> _userManager;
- public ServiceManager(IRepositoryManager repositoryManager, IMapper mapper, UserManager<User> userManager, IConfiguration configuration)
- {
- _bookService = new Lazy<IBookService>(() => new BookService(repositoryManager, mapper));
- _pageService = new Lazy<IPageService>(() => new PageService(repositoryManager, mapper));
- _noteEntityService = new Lazy<INoteEntityService>(() => new NoteEntityService(repositoryManager,mapper));
- _postService = new Lazy<IPostService>(() => new PostService(repositoryManager, mapper));
- _commentService = new Lazy<ICommentService>(() => new CommentService(repositoryManager, mapper));
- _likeService = new Lazy<ILikeService>(() => new LikeService(repositoryManager, mapper));
- _userRelationshipService = new Lazy<IUserRelationshipService>(() => new UserRelationshipService(repositoryManager, mapper));
- _authenticationService = new Lazy<IAuthenticationService>(() => new AuthenticationService(mapper, userManager, configuration));
- _userManager = userManager;
- }
- public IPageService PageService => _pageService.Value;
- public IBookService BookService => _bookService.Value;
- public INoteEntityService NoteEntityServíce => _noteEntityService.Value;
- public IPostService PostService => _postService.Value;
- public ICommentService CommentService => _commentService.Value;
- public ILikeService LikeService => _likeService.Value;
- public IUserRelationshipService UserRelationshipService => _userRelationshipService.Value;
- public IAuthenticationService AuthenticationService => _authenticationService.Value;
- public UserManager<User> UserService =>_userManager;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement