SHARE
TWEET

Untitled

a guest Sep 16th, 2019 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Web.Mvc;
  4. using Ninject;
  5. using SlateCore.BLL.Interfaces;
  6. using SlateCore.BLL.Interfaces.Validations;
  7. using SlateCore.BLL.Services;
  8. using SlateCore.BLL.Services.Validations;
  9. using SlateCORE.Web.Helpers;
  10. using SlateCORE.Web.Interfaces;
  11. using AutoMapper;
  12.  
  13. namespace SlateCORE.Web.Util
  14. {
  15.     /// <summary>
  16.     ///
  17.     /// </summary>
  18.     public class NinjectDependencyResolver : IDependencyResolver
  19.     {
  20.         private IKernel _kernel;
  21.  
  22.         public NinjectDependencyResolver(IKernel kernelParam)
  23.         {
  24.             _kernel = kernelParam;
  25.             AddBindings();
  26.         }
  27.  
  28.  
  29.         private void AddBindings()
  30.         {
  31.             _kernel.Bind<IAccountService>().To<AccountService>();
  32.             _kernel.Bind<ISessionService>().To<SessionService>();
  33.             _kernel.Bind<IFormsAuthenticationService>().To<FormsAuthenticationService>();
  34.             _kernel.Bind<IBookService>().To<BookService>();
  35.             _kernel.Bind<IBookmarkService>().To<BookmarkService>();
  36.             _kernel.Bind<ILibraryService>().To<LibraryService>();
  37.             _kernel.Bind<IHistoryService>().To<HistoryService>();
  38.             _kernel.Bind<IRecommendationService>().To<RecommendationService>();
  39.             _kernel.Bind<ITestService>().To<TestService>();
  40.  
  41.             _kernel.Bind<ISectionService>().To<SectionService>();
  42.             _kernel.Bind<IValidationSection>().To<ValidationSection>();
  43.  
  44.             _kernel.Bind<IGenreService>().To<GenreService>();
  45.             _kernel.Bind<IPurchaseService>().To<PurchaseService>();
  46.  
  47.             _kernel.Bind<IUserAdminService>().To<UserAdminService>();
  48.             _kernel.Bind<IValidationUserAdmin>().To<ValidationUserAdmin>();
  49.  
  50.             _kernel.Bind<IPartnerService>().To<PartnerService>();
  51.             _kernel.Bind<IValidationPartner>().To<ValidationPartner>();
  52.  
  53.             _kernel.Bind<IMapper>().ToMethod(ctx => AutomapperInitializer.MapperInstance);
  54.         }
  55.  
  56.  
  57.         public object GetService(Type serviceType)
  58.         {
  59.             return _kernel.TryGet(serviceType);
  60.         }
  61.  
  62.  
  63.         public IEnumerable<object> GetServices(Type serviceType)
  64.         {
  65.             return _kernel.GetAll(serviceType);
  66.         }
  67.     }
  68. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top