/// <summary> /// Initializes a new instance of the <see cref="CodeBasedConfiguration" /> class. /// </summary> /// <param name="diManager">The DI manager.</param> /// <param name="entryAssemblyFolder"> /// The location where the executable is. /// For non test projects <see cref="IGlobalsCore.EntryAssemblyFolder" /> can be used as a value for this parameter. /// However, for tests projects <see cref="IGlobalsCore.EntryAssemblyFolder" /> might be /// be the folder where the test execution library is, so a different value might need to be passed. /// </param> /// <param name="assemblyProbingPaths">The assembly probing paths.</param> public CodeBasedConfiguration([NotNull] IDiManager diManager, [NotNull] string entryAssemblyFolder, [CanBeNull][ItemNotNull] params string[] assemblyProbingPaths) : base(entryAssemblyFolder) { InitProbingPaths(assemblyProbingPaths); DiManager = diManager; }
/// <summary> /// Creates an instance of <see cref="ICodeBasedDiContainerConfigurator" /> for code based dependency injection /// configuration. /// </summary> /// <param name="diManager">An instance of <see cref="IDiManager" /></param> /// <param name="entryAssemblyFolder">The entry assembly folder.</param> /// <param name="assemblyProbingPaths">The assembly probing paths.</param> /// <exception cref="ConfigurationParseException">Throws this exception if configuration parse/load fails.</exception> /// <exception cref="LoggerWasNotInitializedException"></exception> /// <exception cref="OROptimizer.DynamicCode.DynamicCodeGenerationException">Throws this exception if dynamic code generation fails.</exception> /// <exception cref="Exception">Throws this exception.</exception> public ICodeBasedDiContainerConfigurator StartCodeBasedDi([NotNull] IDiManager diManager, [NotNull] string entryAssemblyFolder, [CanBeNull][ItemNotNull] params string[] assemblyProbingPaths) { if (!LogHelper.IsContextInitialized) { throw new LoggerWasNotInitializedException(); } var configuration = new CodeBasedConfiguration(diManager, entryAssemblyFolder, assemblyProbingPaths); configuration.Init(); return(new CodeBasedDiContainerConfigurator(configuration)); }