/// <summary> /// Sets up the environment for linking this module. /// </summary> public virtual void SetupPrivateLinkEnvironment( UEBuildBinary SourceBinary, LinkEnvironment LinkEnvironment, List <UEBuildBinary> BinaryDependencies, HashSet <UEBuildModule> VisitedModules, DirectoryReference ExeDir ) { // Add the private rpaths LinkEnvironment.RuntimeLibraryPaths.AddRange(ExpandPathVariables(Rules.PrivateRuntimeLibraryPaths, SourceBinary.OutputDir, ExeDir)); // Allow the module's public dependencies to add library paths and additional libraries to the link environment. SetupPublicLinkEnvironment(SourceBinary, LinkEnvironment.LibraryPaths, LinkEnvironment.AdditionalLibraries, LinkEnvironment.RuntimeLibraryPaths, LinkEnvironment.Frameworks, LinkEnvironment.WeakFrameworks, LinkEnvironment.AdditionalFrameworks, LinkEnvironment.AdditionalBundleResources, LinkEnvironment.DelayLoadDLLs, BinaryDependencies, VisitedModules, ExeDir); // Also allow the module's public and private dependencies to modify the link environment. List <UEBuildModule> AllDependencyModules = new List <UEBuildModule>(); AllDependencyModules.AddRange(PrivateDependencyModules); AllDependencyModules.AddRange(PublicDependencyModules); foreach (UEBuildModule DependencyModule in AllDependencyModules) { DependencyModule.SetupPublicLinkEnvironment(SourceBinary, LinkEnvironment.LibraryPaths, LinkEnvironment.AdditionalLibraries, LinkEnvironment.RuntimeLibraryPaths, LinkEnvironment.Frameworks, LinkEnvironment.WeakFrameworks, LinkEnvironment.AdditionalFrameworks, LinkEnvironment.AdditionalBundleResources, LinkEnvironment.DelayLoadDLLs, BinaryDependencies, VisitedModules, ExeDir); } // Add all the additional properties LinkEnvironment.AdditionalProperties.AddRange(Rules.AdditionalPropertiesForReceipt.Inner); // this is a link-time property that needs to be accumulated (if any modules contributing to this module is ignoring, all are ignoring) LinkEnvironment.bIgnoreUnresolvedSymbols |= Rules.bIgnoreUnresolvedSymbols; }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); NinjectModule clientModule = new ClientModule(); NinjectModule usertModule = new UserModule(); NinjectModule categoryModule = new CategoryModule(); NinjectModule priceCategoryModule = new PriceCategoryModule(); NinjectModule roomModule = new RoomModule(); NinjectModule reservationModule = new ReservationModule(); NinjectModule dependencyModule = new DependencyModule("HotelModel"); var kernel = new StandardKernel(dependencyModule, usertModule, clientModule, categoryModule, priceCategoryModule, roomModule, reservationModule); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory(kernel)); //var kernel = new StandardKernel(clientModule, usertModule, categoryModule, // priceCategoryModule, roomModule, reservationModule, dependencyModule); //kernel.Bind<DefaultFilterProviders>().ToSelf().WithConstructorArgument(GlobalConfiguration.Configuration.Services.GetFilterProviders()); //kernel.Bind<DefaultModelValidatorProviders>().ToConstant(new DefaultModelValidatorProviders(GlobalConfiguration.Configuration.Services.GetModelValidatorProviders())); //GlobalConfiguration.Configuration.DependencyResolver = new Ninject.Web.WebApi.NinjectDependencyResolver(kernel); }
public void Test_Ctor() { IServiceCollection services = new ServiceCollection(); var module = new DependencyModule(); services = module.AddServices(services); }
/// <summary> /// Find all the modules which affect the public compile environment. Searches through /// </summary> /// <param name="Modules"></param> /// <param name="ModuleToIncludePathsOnlyFlag"></param> protected void FindModulesInPublicCompileEnvironment(List <UEBuildModule> Modules, Dictionary <UEBuildModule, bool> ModuleToIncludePathsOnlyFlag) { // bool bModuleIncludePathsOnly; if (!ModuleToIncludePathsOnlyFlag.TryGetValue(this, out bModuleIncludePathsOnly)) { Modules.Add(this); } else if (!bModuleIncludePathsOnly) { return; } ModuleToIncludePathsOnlyFlag[this] = false; foreach (UEBuildModule DependencyModule in PublicDependencyModules) { DependencyModule.FindModulesInPublicCompileEnvironment(Modules, ModuleToIncludePathsOnlyFlag); } // Now add an include paths from modules with header files that we need access to, but won't necessarily be importing foreach (UEBuildModule IncludePathModule in PublicIncludePathModules) { IncludePathModule.FindIncludePathModulesInPublicCompileEnvironment(Modules, ModuleToIncludePathsOnlyFlag); } }
/// <summary> /// Sets up the environment for linking this module. /// </summary> public virtual void SetupPrivateLinkEnvironment( UEBuildBinary SourceBinary, LinkEnvironment LinkEnvironment, List <UEBuildBinary> BinaryDependencies, HashSet <UEBuildModule> VisitedModules, DirectoryReference ExeDir ) { // Add the private rpaths LinkEnvironment.RuntimeLibraryPaths.AddRange(ExpandPathVariables(Rules.PrivateRuntimeLibraryPaths, SourceBinary.OutputDir, ExeDir)); // Allow the module's public dependencies to add library paths and additional libraries to the link environment. SetupPublicLinkEnvironment(SourceBinary, LinkEnvironment.LibraryPaths, LinkEnvironment.AdditionalLibraries, LinkEnvironment.RuntimeLibraryPaths, LinkEnvironment.Frameworks, LinkEnvironment.WeakFrameworks, LinkEnvironment.AdditionalFrameworks, LinkEnvironment.AdditionalShadowFiles, LinkEnvironment.AdditionalBundleResources, LinkEnvironment.DelayLoadDLLs, BinaryDependencies, VisitedModules, ExeDir); // Also allow the module's public and private dependencies to modify the link environment. List <UEBuildModule> AllDependencyModules = new List <UEBuildModule>(); AllDependencyModules.AddRange(PrivateDependencyModules); AllDependencyModules.AddRange(PublicDependencyModules); foreach (UEBuildModule DependencyModule in AllDependencyModules) { DependencyModule.SetupPublicLinkEnvironment(SourceBinary, LinkEnvironment.LibraryPaths, LinkEnvironment.AdditionalLibraries, LinkEnvironment.RuntimeLibraryPaths, LinkEnvironment.Frameworks, LinkEnvironment.WeakFrameworks, LinkEnvironment.AdditionalFrameworks, LinkEnvironment.AdditionalShadowFiles, LinkEnvironment.AdditionalBundleResources, LinkEnvironment.DelayLoadDLLs, BinaryDependencies, VisitedModules, ExeDir); } }
public void ConfigureServices(IServiceCollection services) { services.AddRazorPages(); string connection = Configuration.GetConnectionString("DefaultConnection"); var diModule = new DependencyModule(connection); services.AddScoped <IMenu <Dish> >(options => { return(diModule.ConfigureMenuService()); }); services.AddMvc(options => options.EnableEndpointRouting = false); }
public void Test_Ignore() { IServiceCollection services = new ServiceCollection(); var module = new DependencyModule(); services = module.AddServices(services); services.ShouldContain(m => m.ServiceType == typeof(ITestService)); services.ShouldNotContain(m => m.ServiceType == typeof(IIgnoreService)); }
static IServiceCollection SetupServices() { var serviceCollection = new ServiceCollection(); DependencyModule.RegisterDependencies(serviceCollection); SetupLogging(serviceCollection); SetupConfiguration(serviceCollection); return(serviceCollection); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); NinjectModule studentModule = new StudentModule(); NinjectModule dependencyModule = new DependencyModule("NixModel"); var kernel = new StandardKernel(dependencyModule, studentModule); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory(kernel)); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); NinjectModule studentModule = new StudentModule(); NinjectModule dependencyModule = new DependencyModule("NixModel"); var kernel = new StandardKernel(studentModule, dependencyModule); kernel.Bind <DefaultFilterProviders>().ToSelf().WithConstructorArgument(GlobalConfiguration.Configuration.Services.GetFilterProviders()); kernel.Bind <DefaultModelValidatorProviders>().ToConstant(new DefaultModelValidatorProviders(GlobalConfiguration.Configuration.Services.GetModelValidatorProviders())); GlobalConfiguration.Configuration.DependencyResolver = new Ninject.Web.WebApi.NinjectDependencyResolver(kernel); }
/// <summary> /// Sets up the environment for compiling this module. /// </summary> protected virtual void SetupPrivateCompileEnvironment( HashSet <string> IncludePaths, HashSet <string> SystemIncludePaths, List <string> Definitions, List <UEBuildFramework> AdditionalFrameworks ) { HashSet <UEBuildModule> VisitedModules = new HashSet <UEBuildModule>(); if (this.Type.IsGameModule()) { Definitions.Add("DEPRECATED_FORGAME=DEPRECATED"); } // Add this module's private include paths and definitions. AddIncludePathsWithChecks(IncludePaths, PrivateIncludePaths); // Find all the modules that are part of the public compile environment for this module. List <UEBuildModule> Modules = new List <UEBuildModule>(); Dictionary <UEBuildModule, bool> ModuleToIncludePathsOnlyFlag = new Dictionary <UEBuildModule, bool>(); FindModulesInPublicCompileEnvironment(Modules, ModuleToIncludePathsOnlyFlag); // Add in all the modules that are private dependencies foreach (UEBuildModule DependencyModule in PrivateDependencyModules) { DependencyModule.FindModulesInPublicCompileEnvironment(Modules, ModuleToIncludePathsOnlyFlag); } // And finally add in all the modules that are include path only dependencies foreach (UEBuildModule IncludePathModule in PrivateIncludePathModules) { IncludePathModule.FindIncludePathModulesInPublicCompileEnvironment(Modules, ModuleToIncludePathsOnlyFlag); } // Now set up the compile environment for the modules in the original order that we encountered them foreach (UEBuildModule Module in Modules) { Module.AddModuleToCompileEnvironment(Binary, ModuleToIncludePathsOnlyFlag[Module], IncludePaths, SystemIncludePaths, Definitions, AdditionalFrameworks); } }
/// <summary> /// Sets up the environment for linking this module. /// </summary> public virtual void SetupPrivateLinkEnvironment( UEBuildBinary SourceBinary, LinkEnvironment LinkEnvironment, List <UEBuildBinary> BinaryDependencies, HashSet <UEBuildModule> VisitedModules ) { // Allow the module's public dependencies to add library paths and additional libraries to the link environment. SetupPublicLinkEnvironment(SourceBinary, LinkEnvironment.LibraryPaths, LinkEnvironment.AdditionalLibraries, LinkEnvironment.Frameworks, LinkEnvironment.WeakFrameworks, LinkEnvironment.AdditionalFrameworks, LinkEnvironment.AdditionalShadowFiles, LinkEnvironment.AdditionalBundleResources, LinkEnvironment.DelayLoadDLLs, BinaryDependencies, VisitedModules); // Also allow the module's public and private dependencies to modify the link environment. List <UEBuildModule> AllDependencyModules = new List <UEBuildModule>(); AllDependencyModules.AddRange(PrivateDependencyModules); AllDependencyModules.AddRange(PublicDependencyModules); foreach (UEBuildModule DependencyModule in AllDependencyModules) { DependencyModule.SetupPublicLinkEnvironment(SourceBinary, LinkEnvironment.LibraryPaths, LinkEnvironment.AdditionalLibraries, LinkEnvironment.Frameworks, LinkEnvironment.WeakFrameworks, LinkEnvironment.AdditionalFrameworks, LinkEnvironment.AdditionalShadowFiles, LinkEnvironment.AdditionalBundleResources, LinkEnvironment.DelayLoadDLLs, BinaryDependencies, VisitedModules); } }
public ModuleCreated(DependencyModule createdModule) { CreatedModule = createdModule; }
public void Load(DependencyModule module) { }
public ModuleRemoved(DependencyModule removedModule) { RemovedModule = removedModule; }
public void ModuleCreated(DependencyModule module) => _createSubject.OnNext(new ModuleCreated(module));
public void ModuleRemoved(DependencyModule module) => _removeSubject.OnNext(new ModuleRemoved(module));
/// <summary> /// Sets up the environment for linking any module that includes the public interface of this module. /// </summary> protected virtual void SetupPublicLinkEnvironment( UEBuildBinary SourceBinary, List <DirectoryReference> LibraryPaths, List <string> AdditionalLibraries, List <string> RuntimeLibraryPaths, List <string> Frameworks, List <string> WeakFrameworks, List <UEBuildFramework> AdditionalFrameworks, List <string> AdditionalShadowFiles, List <UEBuildBundleResource> AdditionalBundleResources, List <string> DelayLoadDLLs, List <UEBuildBinary> BinaryDependencies, HashSet <UEBuildModule> VisitedModules, DirectoryReference ExeDir ) { // There may be circular dependencies in compile dependencies, so we need to avoid reentrance. if (VisitedModules.Add(this)) { // Add this module's binary to the binary dependencies. if (Binary != null && Binary != SourceBinary && !BinaryDependencies.Contains(Binary)) { BinaryDependencies.Add(Binary); } // If this module belongs to a static library that we are not currently building, recursively add the link environment settings for all of its dependencies too. // Keep doing this until we reach a module that is not part of a static library (or external module, since they have no associated binary). // Static libraries do not contain the symbols for their dependencies, so we need to recursively gather them to be linked into other binary types. bool bIsBuildingAStaticLibrary = (SourceBinary != null && SourceBinary.Type == UEBuildBinaryType.StaticLibrary); bool bIsModuleBinaryAStaticLibrary = (Binary != null && Binary.Type == UEBuildBinaryType.StaticLibrary); if (!bIsBuildingAStaticLibrary && bIsModuleBinaryAStaticLibrary) { // Gather all dependencies and recursively call SetupPublicLinkEnvironmnet List <UEBuildModule> AllDependencyModules = new List <UEBuildModule>(); AllDependencyModules.AddRange(PrivateDependencyModules); AllDependencyModules.AddRange(PublicDependencyModules); foreach (UEBuildModule DependencyModule in AllDependencyModules) { bool bIsExternalModule = (DependencyModule as UEBuildModuleExternal != null); bool bIsInStaticLibrary = (DependencyModule.Binary != null && DependencyModule.Binary.Type == UEBuildBinaryType.StaticLibrary); if (bIsExternalModule || bIsInStaticLibrary) { DependencyModule.SetupPublicLinkEnvironment(SourceBinary, LibraryPaths, AdditionalLibraries, RuntimeLibraryPaths, Frameworks, WeakFrameworks, AdditionalFrameworks, AdditionalShadowFiles, AdditionalBundleResources, DelayLoadDLLs, BinaryDependencies, VisitedModules, ExeDir); } } } // Add this module's public include library paths and additional libraries. LibraryPaths.AddRange(PublicLibraryPaths); AdditionalLibraries.AddRange(PublicAdditionalLibraries); RuntimeLibraryPaths.AddRange(ExpandPathVariables(Rules.PublicRuntimeLibraryPaths, SourceBinary.OutputDir, ExeDir)); Frameworks.AddRange(PublicFrameworks); WeakFrameworks.AddRange(PublicWeakFrameworks); AdditionalBundleResources.AddRange(PublicAdditionalBundleResources); // Remember the module so we can refer to it when needed foreach (UEBuildFramework Framework in PublicAdditionalFrameworks) { Framework.OwningModule = this; } AdditionalFrameworks.AddRange(PublicAdditionalFrameworks); AdditionalShadowFiles.AddRange(PublicAdditionalShadowFiles); DelayLoadDLLs.AddRange(PublicDelayLoadDLLs); } }
public DeckBuilderApiHandlers() { var container = DependencyModule.BuildContainer(); ResolveDependencies(container); }
public void Load(DependencyModule module) { module.Load(this); }