Example #1
0
        /// <summary>
        /// writes a message in the Event Viewer by proving usefull infomration on what assemlbies have been loaded correctly
        /// </summary>
        private static void WriteFoundAssembliesInLog(List <Assembly> result)
        {
            if (result == null || result.Count == 0)
            {
                var messageToThrow =
                    String.Format("Cannot configure ObjectFactory: no assembly is found with the search pattern {0}",
                                  ConfigurationManager.AppSettings[APP_SETTING_KEY_AUTO_LOAD_MODULE_PATTERN]);
                WriteEntryLog(messageToThrow, true);
                throw new DependencyInjectionException(messageToThrow);
            }

            var sb = new StringBuilder();

            sb.AppendLine("###### The kernel's object factory has started using the auto module loading ######");
            sb.AppendLine("The pattern defined in config for searching modules in assemblies is: ");
            sb.AppendLine(ConfigurationManager.AppSettings[APP_SETTING_KEY_AUTO_LOAD_MODULE_PATTERN]);
            sb.AppendLine("Assemblies that matched with selected pattern are listed below. Please note that lower the priority," +
                          "earlier the module is loaded. ");
            foreach (var foundAssembly in result)
            {
                sb.AppendLine(string.Format("- {0} with module loading priority: {1} ", foundAssembly.FullName, PriorityComparer.ReadPriority(foundAssembly)));
            }
            WriteEntryLog(sb.ToString(), false);
        }