Ejemplo n.º 1
0
 private static void LoadModules(KernelBase kernel)
 {
     kernel.Load <CatalogNinjectModule>();
     kernel.Load <OrderNinjectModule>();
     kernel.Load <LoggingNinjectModule>();
     kernel.Load <StatisticsNinjectModule>();
 }
        /// <summary>
        /// Configure the framework and setup IoC container.
        /// </summary>
        /// <exception cref="System.Windows.ResourceReferenceKeyNotFoundException"></exception>
        protected override void Configure()
        {
            _PublicKey = Assembly.GetExecutingAssembly().GetName().GetPublicKey();

            // Ninject IoC module Configuration
            var moduleBaseDirectory = new DirectoryInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Settings.Default.ModuleBaseDir));
            var modules             = moduleBaseDirectory.EnumerateFiles(Settings.Default.ModuleSearchPattern, SearchOption.AllDirectories);
            var moduleFileInfos     = modules as List <FileInfo> ?? modules.ToList();

            if (!moduleFileInfos.Any())
            {
                throw new ResourceReferenceKeyNotFoundException(string.Format("Unable to find Modules at {0} with search pattern {1}", Settings.Default.ModuleBaseDir, Settings.Default.ModuleSearchPattern), Settings.Default.ModuleBaseDir);
            }

            var moduleAssemblies      = moduleFileInfos.Select(file => Assembly.LoadFile(file.FullName)).Concat(new[] { this.GetType().Assembly }).ToArray();
            var validModuleAssembiles = moduleAssemblies.Where(CheckAssemblySignature).ToList();

            // Load Modules via Ninject Kernel
            _kernel.Load(validModuleAssembiles);

            // Import Assemblys into Caliburn for inspection
            AssemblySource.Instance.AddRange(validModuleAssembiles);

            SetupConvention();
            base.Configure();
        }
Ejemplo n.º 3
0
 private static void RegisterServices(KernelBase kernel)
 {
     kernel.Load(new InternalBinder());
     kernel.Load(new ExternalBinder());
 }
Ejemplo n.º 4
0
 static IoC()
 {
     _kernel = new StandardKernel();
     _kernel.Load(new ServiceBindings());
 }
Ejemplo n.º 5
0
 private static void LoadModules(KernelBase kernel)
 {
     kernel.Load <OrderNinjectModule>();
     kernel.Load <AccountNinjectModule>();
 }