コード例 #1
0
ファイル: NinjectModule.cs プロジェクト: LuckyStarry/Ninject
 /// <summary>
 /// Called when the module is unloaded from a kernel.
 /// </summary>
 /// <param name="kernelConfiguration">The kernel configuration that is unloading the module.</param>
 public void OnUnload(IKernelConfiguration kernelConfiguration)
 {
     this.Unload();
     this.Bindings.Map(this.KernelConfiguration.RemoveBinding);
     this.KernelConfiguration = null;
 }
コード例 #2
0
        /// <summary>
        /// Loads modules from the files that match the specified pattern(s).
        /// </summary>
        /// <param name="kernelConfiguration">The kernel configuration into which the module is loaded.</param>
        /// <param name="filePatterns">The file patterns (i.e. "*.dll", "modules/*.rb") to match.</param>
        public static void Load(this IKernelConfiguration kernelConfiguration, params string[] filePatterns)
        {
            Ensure.ArgumentNotNull(kernelConfiguration, "kernelConfiguration");

            kernelConfiguration.Load(filePatterns);
        }
コード例 #3
0
        /// <summary>
        /// Loads modules defined in the specified assemblies.
        /// </summary>
        /// <param name="kernelConfiguration">The kernel configuration into which the module is loaded.</param>
        /// <param name="assemblies">The assemblies to search.</param>
        public static void Load(this IKernelConfiguration kernelConfiguration, params Assembly[] assemblies)
        {
            Ensure.ArgumentNotNull(kernelConfiguration, "kernelConfiguration");

            kernelConfiguration.Load(assemblies);
        }
コード例 #4
0
ファイル: KernelBase.cs プロジェクト: xydoublez/Ninject
 /// <summary>
 /// Initializes a new instance of the <see cref="KernelBase"/> class.
 /// </summary>
 /// <param name="components">The component container to use.</param>
 /// <param name="settings">The configuration to use.</param>
 /// <param name="modules">The modules to load into the kernel.</param>
 protected KernelBase(IComponentContainer components, INinjectSettings settings, params INinjectModule[] modules)
 {
     this.kernelConfiguration = new KernelConfiguration(components, settings, modules);
     this.kernelConfiguration.Bind <IKernel>().ToMethod(ctx => this);
     this.kernelConfiguration.Bind <IResolutionRoot>().ToMethod(ctx => this).When(ctx => true);
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CompiledModuleLoaderPlugin"/> class.
 /// </summary>
 /// <param name="kernelConfiguration">The kernel configuration into which modules will be loaded.</param>
 /// <param name="assemblyNameRetriever">The assembly name retriever.</param>
 public CompiledModuleLoaderPlugin(IKernelConfiguration kernelConfiguration, IAssemblyNameRetriever assemblyNameRetriever)
 {
     this.KernelConfiguration = kernelConfiguration;
     this.assemblyNameRetriever = assemblyNameRetriever;
 }
コード例 #6
0
 /// <summary>
 /// Called when the module is unloaded from a kernel.
 /// </summary>
 /// <param name="kernelConfiguration">The kernel configuration that is unloading the module.</param>
 public void OnUnload(IKernelConfiguration kernelConfiguration)
 {
     this.Unload();
     this.Bindings.Map(this.KernelConfiguration.RemoveBinding);
     this.KernelConfiguration = null;
 }
コード例 #7
0
ファイル: Startup.cs プロジェクト: Sviatoslav2/ucubot3
 public static void BindToMethod <T>(this IKernelConfiguration config, Func <T> method) => config.Bind <T>().ToMethod(c => method());
コード例 #8
0
 /// <summary>
 /// Loads modules from the files that match the specified pattern(s).
 /// </summary>
 /// <param name="kernelConfiguration">The kernel configuration into which the files are loaded.</param>
 /// <param name="filePatterns">The file patterns (i.e. "*.dll", "modules/*.rb") to match.</param>
 public static void Load(this IKernelConfiguration kernelConfiguration, params string[] filePatterns)
 {
     kernelConfiguration.Load(filePatterns);
 }
コード例 #9
0
 /// <summary>
 /// Loads modules defined in the specified assemblies.
 /// </summary>
 /// <param name="kernelConfiguration">The kernel configuration into which the assemblies are loaded.</param>
 /// <param name="assemblies">The assemblies to search.</param>
 public static void Load(this IKernelConfiguration kernelConfiguration, params Assembly[] assemblies)
 {
     kernelConfiguration.Load(assemblies);
 }
コード例 #10
0
 /// <summary>
 /// Creates a new instance of the module and loads it into the kernel.
 /// </summary>
 /// <typeparam name="TModule">The type of the module.</typeparam>
 /// <param name="kernelConfiguration">The kernel configuration into which the module is loaded.</param>
 public static void Load <TModule>(this IKernelConfiguration kernelConfiguration)
     where TModule : INinjectModule, new()
 {
     kernelConfiguration.Load(new TModule());
 }
コード例 #11
0
 /// <summary>
 /// Loads the module(s) into the kernel.
 /// </summary>
 /// <param name="kernelConfiguration">The kernel configuration.</param>
 /// <param name="modules">The modules to load into which the modules are loaded.</param>
 public static void Load(this IKernelConfiguration kernelConfiguration, params INinjectModule[] modules)
 {
     kernelConfiguration.Load(modules);
 }
コード例 #12
0
ファイル: KernelBase.cs プロジェクト: LuckyStarry/Ninject
 /// <summary>
 /// Initializes a new instance of the <see cref="KernelBase"/> class.
 /// </summary>
 /// <param name="components">The component container to use.</param>
 /// <param name="settings">The configuration to use.</param>
 /// <param name="modules">The modules to load into the kernel.</param>
 protected KernelBase(IComponentContainer components, INinjectSettings settings, params INinjectModule[] modules)
 {
     this.kernelConfiguration = new KernelConfiguration(components, settings, modules);
     this.kernelConfiguration.Bind<IKernel>().ToMethod(ctx => this);
     this.kernelConfiguration.Bind<IResolutionRoot>().ToMethod(ctx => this).When(ctx => true);
     }
コード例 #13
0
 public SpecialResolutionContext()
 {
     this.kernelConfiguration = new KernelConfiguration();
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModuleLoader"/> class.
 /// </summary>
 /// <param name="kernelConfiguration">The kernel configuration into which modules will be loaded.</param>
 public ModuleLoader(IKernelConfiguration kernelConfiguration)
 {
     KernelConfiguration = kernelConfiguration;
 }
コード例 #15
0
ファイル: NinjectModule.cs プロジェクト: LuckyStarry/Ninject
 /// <summary>
 /// Called when the module is loaded into a kernel.
 /// </summary>
 /// <param name="kernelConfiguration">The kernel configuration that is loading the module.</param>
 public void OnLoad(IKernelConfiguration kernelConfiguration)
 {
     this.KernelConfiguration = kernelConfiguration;
     this.Load();
 }
コード例 #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CompiledModuleLoaderPlugin"/> class.
 /// </summary>
 /// <param name="kernelConfiguration">The kernel configuration into which modules will be loaded.</param>
 /// <param name="assemblyNameRetriever">The assembly name retriever.</param>
 public CompiledModuleLoaderPlugin(IKernelConfiguration kernelConfiguration, IAssemblyNameRetriever assemblyNameRetriever)
 {
     this.KernelConfiguration   = kernelConfiguration;
     this.assemblyNameRetriever = assemblyNameRetriever;
 }
 public NinjectInstanceResolverFactory(INinjectModule[] veriableModules, INinjectModule[] constantModules)
 {
     _veriableModules     = veriableModules;
     _kernelConfiguration = new KernelConfiguration(constantModules);
     //bunu get instance içine alabilirsin çünkü her seferinde build  olamsı gerekiyor.
 }
コード例 #18
0
 public void AbcFeaturesResolveCorrectly(Type featureType, IKernelConfiguration kernelConfiguration, string testName)
 {
     TestKernelInitializer.AssertCanBuildFeature(featureType, kernelConfiguration, testName);
 }
コード例 #19
0
 /// <summary>
 /// Called when the module is loaded into a kernel.
 /// </summary>
 /// <param name="kernelConfiguration">The kernel configuration that is loading the module.</param>
 public void OnLoad(IKernelConfiguration kernelConfiguration)
 {
     this.KernelConfiguration = kernelConfiguration;
     this.Load();
 }
コード例 #20
0
 public AssemblyBootStep(ISetting <IKernelConfiguration> kernelConfiguration, IAssemblySubSystem assemblySubSystem)
 {
     _kernelConfiguration = kernelConfiguration.Value;
     _assemblySubSystem   = assemblySubSystem;
 }
コード例 #21
0
ファイル: ModuleLoader.cs プロジェクト: LuckyStarry/Ninject
 /// <summary>
 /// Initializes a new instance of the <see cref="ModuleLoader"/> class.
 /// </summary>
 /// <param name="kernelConfiguration">The kernel configuration into which modules will be loaded.</param>
 public ModuleLoader(IKernelConfiguration kernelConfiguration)
 {
     KernelConfiguration = kernelConfiguration;
 }
コード例 #22
0
        /// <summary>
        /// Loads the module(s) into the kernel.
        /// </summary>
        /// <param name="kernelConfiguration">The kernel configuration into which the module is loaded.</param>
        /// <param name="modules">The modules to load.</param>
        public static void Load(this IKernelConfiguration kernelConfiguration, params INinjectModule[] modules)
        {
            Ensure.ArgumentNotNull(kernelConfiguration, "kernelConfiguration");

            kernelConfiguration.Load(modules);
        }
コード例 #23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ModuleLoader"/> class.
        /// </summary>
        /// <param name="kernelConfiguration">The kernel configuration into which modules will be loaded.</param>
        /// <exception cref="ArgumentNullException"><paramref name="kernelConfiguration"/> is <see langword="null"/>.</exception>
        public ModuleLoader(IKernelConfiguration kernelConfiguration)
        {
            Ensure.ArgumentNotNull(kernelConfiguration, nameof(kernelConfiguration));

            this.kernelConfiguration = kernelConfiguration;
        }
コード例 #24
0
        private IEnumerator ConfigureAsync(IKernelConfiguration configuration)
        {
            yield return(StartCoroutine(configuration.Configure()));

            --_configurationsInProgress;
        }