本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}
}
示例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) { }
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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
}
示例10: CreateKernel
private static IKernel CreateKernel()
{
var kernel = new StandardKernel();
try
{
RegisterServices(kernel);
return kernel;
}
catch
{
kernel.Dispose();
throw;
}
}
示例11: CreateInfoDigestKernel
private static IKernel CreateInfoDigestKernel()
{
var kernel = new StandardKernel();
try
{
kernel.Bind<IInfoDigestApplicationUnit>().To<InfoDigestApplicationUnit>();
return kernel;
}
catch (Exception)
{
kernel.Dispose();
throw;
}
}
示例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;
}
}
示例13: CreateKernel
public static IKernel CreateKernel()
{
var kernel = new StandardKernel();
try
{
kernel.Load(Assembly.GetExecutingAssembly());
RegisterServices(kernel);
return kernel;
}
catch
{
kernel.Dispose();
throw;
}
}
示例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;
}
}
示例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;
}
}