當前位置: 首頁>>代碼示例>>C#>>正文


C# StandardKernel.Dispose方法代碼示例

本文整理匯總了C#中Ninject.StandardKernel.Dispose方法的典型用法代碼示例。如果您正苦於以下問題:C# StandardKernel.Dispose方法的具體用法?C# StandardKernel.Dispose怎麽用?C# StandardKernel.Dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Ninject.StandardKernel的用法示例。


在下文中一共展示了StandardKernel.Dispose方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CreateKernel

        /// <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;
            }
        }
開發者ID:edmarjunior,項目名稱:Restaurante,代碼行數:34,代碼來源:NinjectWebCommon.cs

示例2: CreateKernel

        /// <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;
            }
        }
開發者ID:lance22me,項目名稱:BiggResponsive,代碼行數:30,代碼來源:NinjectWebCommon.cs

示例3: CreateKernel

        /// <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;
            }
        }
開發者ID:hstjep,項目名稱:EvidencijaClanovaWebAPI,代碼行數:29,代碼來源:NinjectWebCommon.cs

示例4: Main

        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) { }
        }
開發者ID:anthony-martin,項目名稱:Triangles-in-space,代碼行數:25,代碼來源:TrianglesInSpace.cs

示例5: CreateKernel

        /// <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;
            }
        }
開發者ID:vishalavalani,項目名稱:Quiz-App,代碼行數:32,代碼來源:NinjectWebCommon.cs

示例6: CreateKernel

        /// <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;
            }
        }
開發者ID:csyntax,項目名稱:BlogSystem,代碼行數:29,代碼來源:NinjectWebCommon.cs

示例7: CreateKernel

 /// <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;
     }
 }
開發者ID:sjcole,項目名稱:Huxley,代碼行數:17,代碼來源:NinjectWebCommon.cs

示例8: CreateKernel

 /// <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;
     }
 }
開發者ID:kingakimbrel,項目名稱:OnlineBookStore,代碼行數:17,代碼來源:NinjectWebCommon.cs

示例9: Main

        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
        }
開發者ID:toddenglewood,項目名稱:tictactoe,代碼行數:14,代碼來源:Program.cs

示例10: CreateKernel

 private static IKernel CreateKernel()
 {
     var kernel = new StandardKernel();
     try
     {
         RegisterServices(kernel);
         return kernel;
     }
     catch
     {
         kernel.Dispose();
         throw;
     }
 }
開發者ID:muroslavko,項目名稱:ToDo_List,代碼行數:14,代碼來源:NinjectWebCommon.cs

示例11: CreateInfoDigestKernel

 private static IKernel CreateInfoDigestKernel()
 {
     var kernel = new StandardKernel();
     try
     {
         kernel.Bind<IInfoDigestApplicationUnit>().To<InfoDigestApplicationUnit>();
         return kernel;
     }
     catch (Exception)
     {
         kernel.Dispose();
         throw;
     }
 }
開發者ID:Aleksask,項目名稱:InfoDigest,代碼行數:14,代碼來源:WebApiConfig.cs

示例12: Instance

        /// <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;
            }
        }
開發者ID:Deith2,項目名稱:ProjectIntrduction,代碼行數:19,代碼來源:NinjectConsoleCommon.cs

示例13: CreateKernel

 public static IKernel CreateKernel()
 {
     var kernel = new StandardKernel();
     try
     {
         kernel.Load(Assembly.GetExecutingAssembly());
         RegisterServices(kernel);
         return kernel;
     }
     catch
     {
         kernel.Dispose();
         throw;
     }
 }
開發者ID:geekbazar,項目名稱:MoviesBook,代碼行數:15,代碼來源:NinjectConfig.cs

示例14: CreateKernel

        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;
            }
        }
開發者ID:proactima,項目名稱:UXRiskLogger,代碼行數:16,代碼來源:NinjectWebCommon.cs

示例15: CreateKernel

 /// <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;
     }
 }
開發者ID:ninamarkoff,項目名稱:ValidataTask,代碼行數:21,代碼來源:NinjectWebCommon.cs


注:本文中的Ninject.StandardKernel.Dispose方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。