Beispiel #1
0
        /// <summary>
        /// Builds the default configuration item factory.
        /// </summary>
        /// <returns>Default factory.</returns>
        private static ConfigurationItemFactory BuildDefaultFactory <TConfigurationAssembly>()
        {
            var assembly         = typeof(TConfigurationAssembly).Assembly;
            var factory          = new ConfigurationItemFactory(assembly);
            var assemblyLocation = Path.GetDirectoryName(assembly.Location);

            if (assemblyLocation == null)
            {
                return(factory);
            }

            var extensionDlls = Directory.GetFiles(assemblyLocation, "Gem*.dll")
                                .Select(Path.GetFileName)
                                .Where(x => !x.Equals("Gem.Tests.dll", StringComparison.OrdinalIgnoreCase))
                                .Select(x => Path.Combine(assemblyLocation, x));

            foreach (var extensionDll in extensionDlls)
            {
                //TODO: log
                var extensionAssembly = Assembly.LoadFrom(extensionDll);
                factory.RegisterItemsFromAssembly(extensionAssembly);
            }
            return(factory);
        }
Beispiel #2
0
 internal Factory(ConfigurationItemFactory parentFactory)
 {
     this.parentFactory = parentFactory;
 }