Ejemplo n.º 1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="FileBasedConfiguration" /> class.
 /// </summary>
 /// <param name="configurationFileContentsProvider">
 ///     The configuration file contents provider. An example implementation of
 ///     <see cref="IConfigurationFileContentsProvider" /> implementation is
 ///     <see cref="FileBasedConfigurationFileContentsProvider" />
 /// </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="loadedAssemblies"> Instance of <see cref="ILoadedAssemblies"/> used to add add all or some of currently
 ///                     loaded assemblies as dependencies for  dynamically generated assemblies.
 ///                     Use an instance of <see cref="AllLoadedAssemblies"/> to add references to all assemblies loaded into current application
 ///                     domain to the dynamically generated assembly. Use <see cref="NoLoadedAssemblies"/> to not add any additional assemblies
 ///                     references to any additional assemblies as dependencies for  dynamically generated assemblies.
 ///                     Provide your own implementation to add only some of loaded assemblies as dependencies.
 /// </param>
 public FileBasedConfigurationParameters([NotNull] IConfigurationFileContentsProvider configurationFileContentsProvider,
                                         [NotNull] string entryAssemblyFolder, [NotNull] ILoadedAssemblies loadedAssemblies)
 {
     ConfigurationFileContentsProvider = configurationFileContentsProvider;
     EntryAssemblyFolder = entryAssemblyFolder;
     LoadedAssemblies    = loadedAssemblies;
 }
 /// <summary>
 ///     Creates an instance of <see cref="IFileBasedDiContainerConfigurator" /> for file based dependency injection
 ///     configuration.
 /// </summary>
 /// <param name="configurationFileContentsProvider">
 ///     The configuration file contents provider.
 ///     An example implementation of <see cref="IConfigurationFileContentsProvider" /> implementation is
 ///     <see cref="FileBasedConfigurationFileContentsProvider" />
 /// </param>
 /// <param name="entryAssemblyFolder">The entry assembly folder.</param>
 /// <param name="loadedConfiguration">
 ///     Output parameter that returns an instance of
 ///     <see cref="ConfigurationFile.IConfiguration" />.
 /// </param>
 /// <param name="configurationFileXmlDocumentLoaded">The configuration file XML document loaded.</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 IFileBasedDiContainerConfigurator StartFileBasedDi([NotNull] IConfigurationFileContentsProvider configurationFileContentsProvider,
                                                           [NotNull] string entryAssemblyFolder,
                                                           out IConfiguration loadedConfiguration,
                                                           [CanBeNull] ConfigurationFileXmlDocumentLoadedEventHandler configurationFileXmlDocumentLoaded = null)
 {
     return(StartFileBasedDi(configurationFileContentsProvider, entryAssemblyFolder, new AllLoadedAssemblies(), out loadedConfiguration,
                             configurationFileXmlDocumentLoaded));
 }
 /// <summary>
 ///     Creates an instance of <see cref="IFileBasedDiContainerConfigurator" /> for file based dependency injection
 ///     configuration.
 /// </summary>
 /// <param name="configurationFileContentsProvider">
 ///     The configuration file contents provider.
 ///     An example implementation of <see cref="IConfigurationFileContentsProvider" /> implementation is
 ///     <see cref="FileBasedConfigurationFileContentsProvider" />
 /// </param>
 /// <param name="entryAssemblyFolder">The entry assembly folder.</param>
 /// <param name="loadedAssemblies"> Instance of <see cref="ILoadedAssemblies"/> used to add add all or some of currently
 ///                     loaded assemblies as dependencies for  dynamically generated assemblies.
 ///                     Use an instance of <see cref="AllLoadedAssemblies"/> to add references to all assemblies loaded into current application
 ///                     domain to the dynamically generated assembly. Use <see cref="NoLoadedAssemblies"/> to not add any additional assemblies
 ///                     references to any additional assemblies as dependencies for  dynamically generated assemblies.
 ///                     Provide your own implementation to add only some of loaded assemblies as dependencies.
 /// </param>
 /// <param name="loadedConfiguration">
 ///     Output parameter that returns an instance of
 ///     <see cref="ConfigurationFile.IConfiguration" />.
 /// </param>
 /// <param name="configurationFileXmlDocumentLoaded">The configuration file XML document loaded.</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 IFileBasedDiContainerConfigurator StartFileBasedDi([NotNull] IConfigurationFileContentsProvider configurationFileContentsProvider,
                                                           [NotNull] string entryAssemblyFolder,
                                                           [NotNull] ILoadedAssemblies loadedAssemblies,
                                                           out IConfiguration loadedConfiguration,
                                                           [CanBeNull] ConfigurationFileXmlDocumentLoadedEventHandler configurationFileXmlDocumentLoaded = null)
 {
     return(StartFileBasedDi(new FileBasedConfigurationParameters(configurationFileContentsProvider, entryAssemblyFolder, loadedAssemblies)
     {
         ConfigurationFileXmlDocumentLoaded = configurationFileXmlDocumentLoaded
     }, out loadedConfiguration));
 }