예제 #1
0
        public NinjectResolver GetResolver()
        {
            var kernel = new StandardKernel();

            kernel.Bind <IBooksRepository>().To <InMemoryBooksRepository>().InSingletonScope();
            kernel.Bind <IAuthorsRepository>().To <InMemoryAuthosRepository>().InSingletonScope();
            kernel.Bind <IFilesRepository>().To <SimpleFileRepository>().InSingletonScope();
            kernel.Bind <IUserSettingsRepository>().To <InMemorySettingsRepository>().InSingletonScope();
            kernel.Bind <BooksService>().ToSelf().InTransientScope();
            kernel.Bind <UserService>().ToSelf().InTransientScope();
            //kernel.Bind<BooksController>().ToSelf().InTransientScope();

            var ninjectResolver = new NinjectResolver(kernel);

            return(ninjectResolver);
        }
예제 #2
0
 public void Dispose()
 {
     _depsolver = null;
 }
예제 #3
0
 public DepScope(NinjectResolver depsolver)
 {
     _depsolver = depsolver;
 }