当前位置: 首页>>代码示例>>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;未经允许,请勿转载。