/// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            var kernel = new StandardKernel();
            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
                kernel.Bind<IDataBaseConnection>().To<DataBaseConnection>();
                kernel.Bind<IFornecedorRepository>().To<FornecedorRepository>();
                kernel.Bind<IProdutoRepository>().To<ProdutoRepository>();
                kernel.Bind<IFuncionarioRepository>().To<FuncionarioRepository>();
                kernel.Bind<IClienteRepository>().To<ClienteRepository>();
                kernel.Bind<ILoginRepository>().To<LoginRepository>();
                kernel.Bind<IComandaRepository>().To<ComandaRepository>();
                kernel.Bind<IPedidoRepository>().To<PedidoRepository>();
                kernel.Bind<ICompromissoRepository>().To<CompromissoRepository>();
                kernel.Bind<IContaRepository>().To<ContaRepository>();
                kernel.Bind<IControleCaixaRepository>().To<ControleCaixaRepository>();
                kernel.Bind<IEstoqueRepository>().To<EstoqueRepository>();
                kernel.Bind<IResumoVendaRepository>().To<ResumoVendaRepository>();

                RegisterServices(kernel);
                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            log4net.Config.XmlConfigurator.Configure();
            var settings = new NinjectSettings { LoadExtensions = false };
            var kernel = new StandardKernel(settings, new INinjectModule[] { new Log4NetModule() });

            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

                RegisterServices(kernel);
                // ControllerBuilder.Current.SetControllerFactory(new ControllerFactory(kernel)); <-- used that until WebApi entered the solution\

                System.Web.Http.GlobalConfiguration.Configuration.DependencyResolver = new NinjectDependencyResolver(kernel); // webApi controller
                System.Web.Mvc.DependencyResolver.SetResolver(new NinjectMvcDependencyResolver(kernel)); // mvc controller

                return kernel;
            }
            catch(Exception ex)
            {
                var foo = ex.Message;
                kernel.Dispose();
                throw;
            }
        }
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            var settings = new NinjectSettings();
            settings.LoadExtensions = true;
            settings.ExtensionSearchPatterns = settings.ExtensionSearchPatterns
                .Union(new string[] { "EvidencijaClanova.*.dll" }).ToArray();
            var kernel = new StandardKernel(settings);

            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

                RegisterServices(kernel);

                GlobalConfiguration.Configuration.DependencyResolver = new NinjectDependencyResolver(kernel);

                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
        public static void Main()
        {
            try
            {
                var module = new TriangleModule();
                var kernel = new StandardKernel(module);
                //var context = ZmqContext.Create();
                //var receiver = new MessageReceiver(context);
                //receiver.Listen();
                //var bus = new MessageBus(new MessageSender(context), receiver, new MessageRegistrationList());

                var selectableObjectRepository = kernel.Get<SelectableObjectRepository>();

                //var renderer = kernel.Get<Renderer>();
                //var form = kernel.Get<Form1>();
                //form.GO();
                //renderer.StartRendering();

                var form = kernel.Get<GameFormWpf>();
                form.GO();

                kernel.Dispose();
            }
            catch (OperationCanceledException) { }
        }
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            var kernel = new StandardKernel();
            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
                kernel.Bind<ICategoryRepository>().To<CategoryRepository>();
                kernel.Bind<ISubCategoryRepository>().To<SubCategoryRepository>();
                kernel.Bind<ILanguageRepository>().To<LanguageRepository>();
                kernel.Bind<ILevelRepository>().To<LevelRepository>();
                kernel.Bind<ICutOffScoreRepository>().To<CutOffScoreRepository>();
                kernel.Bind<IQuestionTypeRepository>().To<QuestionTypeRepository>();
                kernel.Bind<IQuizRepository>().To<QuizRepository>();
                kernel.Bind<IRoleRepository>().To<RoleRepository>();
                kernel.Bind<IUserRepository>().To<UserRepository>();
                kernel.Bind<IQuizFileRepository>().To<QuizFileRepository>();
                kernel.Bind<IQuestionTagRepository>().To<QuestionTagRepository>();

                RegisterServices(kernel);
                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
Beispiel #6
0
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            var kernel = new StandardKernel();

            try
            {
                kernel
                    .Bind<Func<IKernel>>()
                    .ToMethod(ctx => () => new Bootstrapper().Kernel);

                kernel
                    .Bind<IHttpModule>()
                    .To<HttpApplicationInitializationHttpModule>();

                RegisterServices(kernel);

                return kernel;
            }
            catch
            {
                kernel.Dispose();

                throw;
            }
        }
Beispiel #7
0
 /// <summary>
 /// Creates the kernel that will manage your application.
 /// </summary>
 /// <returns>The created kernel.</returns>
 private static IKernel CreateKernel() {
     var kernel = new StandardKernel();
     try {
         kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
         kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
         kernel.Bind<ILdbClient>().To<LdbClient>().InRequestScope();
         kernel.Bind<LDBServiceSoapClient>().To<LDBServiceSoapClient>().InRequestScope();
         return kernel;
     } catch {
         kernel.Dispose();
         throw;
     }
 }
 /// <summary>
 /// Creates the kernel that will manage your application.
 /// </summary>
 /// <returns>The created kernel.</returns>
 public static IKernel CreateKernel()
 {
     var kernel = new StandardKernel();
     try
     {
         return CreateKernel(kernel);
     }
     catch
     {
         kernel.Dispose();
         throw;
     }
 }
Beispiel #9
0
        static void Main()
        {
            var kernel = new StandardKernel();
            kernel.Load(new TictactoeModule()); // register

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var mainForm = kernel.Get<Form1>(); // resolve

            Application.Run(mainForm);

            kernel.Dispose(); // release
        }
 private static IKernel CreateKernel()
 {
     var kernel = new StandardKernel();
     try
     {
         RegisterServices(kernel);
         return kernel;
     }
     catch
     {
         kernel.Dispose();
         throw;
     }
 }
Beispiel #11
0
 private static IKernel CreateInfoDigestKernel()
 {
     var kernel = new StandardKernel();
     try
     {
         kernel.Bind<IInfoDigestApplicationUnit>().To<InfoDigestApplicationUnit>();
         return kernel;
     }
     catch (Exception)
     {
         kernel.Dispose();
         throw;
     }
 }
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        public static IKernel Instance()
        {
            var kernel = new StandardKernel();
            try
            {
                NinjectConsoleContainer.Container(kernel);

                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
Beispiel #13
0
 public static IKernel CreateKernel()
 {
     var kernel = new StandardKernel();
     try
     {
         kernel.Load(Assembly.GetExecutingAssembly());
         RegisterServices(kernel);
         return kernel;
     }
     catch
     {
         kernel.Dispose();
         throw;
     }
 }
        private static IKernel CreateKernel()
        {
            var kernel = new StandardKernel(new AutomaticLoggingInjectionModule(), new Log4NetModule());
            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
 /// <summary>
 /// Creates the kernel that will manage your application.
 /// </summary>
 /// <returns>The created kernel.</returns>
 private static IKernel CreateKernel()
 {
     var kernel = new StandardKernel();
     try
     {
         kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
         kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
         //System.Web.Http.GlobalConfiguration.Configuration.DependencyResolver = new Ninject.Web.WebApi.NinjectDependencyResolver(kernel);
         RegisterServices(kernel);
         return kernel;
     }
     catch
     {
         kernel.Dispose();
         throw;
     }
 }
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            Kernel = new StandardKernel(new ControllerNinjectModule());
            try
            {
                Kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                Kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

                RegisterServices(Kernel);
                return Kernel;
            }
            catch
            {
                Kernel.Dispose();
                throw;
            }
        }
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            //var module = new INinjectModule[] { new DomainModule("DefaultConnection") };
            var kernel = new StandardKernel(/*module*/);
            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

                RegisterServices(kernel);
                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
Beispiel #18
0
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            var kernel = new StandardKernel();
            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
                //kernel.Bind<DbContext>().ToConstructor(T => new BlogEntities()).InRequestScope();

                RegisterServices(kernel);
                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
Beispiel #19
0
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            var modules = new INinjectModule[] {new ServiceModule("SqlServerMotorDepot")};
            var kernel = new StandardKernel(modules);
            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

                RegisterServices(kernel);
                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
Beispiel #20
0
        public static IKernel CreateKernel()
        {
            var kernel = new StandardKernel();
            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
                kernel.Bind<DB>().ToSelf().InRequestScope();

                GlobalConfiguration.Configuration.DependencyResolver = new NinjectResolver(kernel);
                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
Beispiel #21
0
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            StandardKernel kernel = new StandardKernel();
            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

                NinjectBinder ninjectBinder = new NinjectBinder(kernel);
                ninjectBinder.Load();

                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
 /// <summary>
 /// Creates the kernel that will manage your application.
 /// </summary>
 /// <returns>The created kernel.</returns>
 private static IKernel CreateKernel()
 {
     var kernel = new StandardKernel();
     try
     {
         kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
         kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
         kernel.Load(Assembly.GetExecutingAssembly());
         kernel.Load("*.Business.dll");
         kernel.Load("*.Data.dll");
         RegisterServices(kernel);
         return kernel;
     }
     catch
     {
         kernel.Dispose();
         throw;
     }
 }
Beispiel #23
0
        private static IKernel CreateKernel()
        {
            var kernel = new StandardKernel();
            try
            {
                //kernel.Components.Add<INinjectHttpApplicationPlugin, NinjectWebApiHttpApplicationPlugin>();
                //kernel.Components.Add<IWebApiRequestScopeProvider, DefaultWebApiRequestScopeProvider>();

                //kernel.Bind<IKernel>().ToMethod(ctx => ctx.Kernel);
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => ctx.Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            // устанавливаем строку подключения
            var modules = new INinjectModule[] { new ServiceModule("DefaultConnection") };
            var kernel = new StandardKernel(modules);
            try
            {
            kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
            kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

            RegisterServices(kernel);
            return kernel;
            }
            catch
            {
            kernel.Dispose();
            throw;
            }
        }
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            var kernel = new StandardKernel();
            try {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

                RegisterServices(kernel);

                //Ninject.Web.WebApi don't support mvc4 now. fix issus form http://stackoverflow.com/a/10855037/346701
                GlobalConfiguration.Configuration.DependencyResolver = new SpiderMan.App_Start.NinjectDependencyResolver(kernel);

                Kernel = kernel;
                return kernel;
            } catch {
                kernel.Dispose();
                throw;
            }
        }
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            //var settings = new NinjectSettings { LoadExtensions = false, InjectAttribute = typeof(NinjectServiceAttribute) };
            var kernel = new StandardKernel();
            try
            {
                kernel.Settings.InjectNonPublic = true;
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

                RegisterServices(kernel);
                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            var kernel = new StandardKernel();
            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

                //Specifically for Web API projects otherwise ninject won't work.
                GlobalConfiguration.Configuration.DependencyResolver = kernel.Get<System.Web.Http.Dependencies.IDependencyResolver>();

                RegisterServices(kernel);
                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
Beispiel #28
0
        private static IKernel CreateKernel()
        {
            var kernel = new StandardKernel();
            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new NinjectBootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

                RegisterTypes(kernel);

                DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));

                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            var kernel = new StandardKernel();
            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
                kernel.Bind<ApplicationDbContext>().ToSelf().InRequestScope();
                kernel.Bind<IAdminManager>().To<AdminManager>();
                kernel.Bind<IResearcherManager>().To<ResearcherManager>();

                RegisterServices(kernel);
                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            var kernel = new StandardKernel();
            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
                kernel.Bind<DesiReviewContext>().To<DesiReviewContext>().InRequestScope();
                kernel.Bind<IDesiReviewRepository>().To<DesiReviewRepository>().InRequestScope();
                RegisterServices(kernel);

                GlobalConfiguration.Configuration.DependencyResolver = new NinjectResolver(kernel);
                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }