/// <summary> /// Processes a specific assembly /// </summary> /// <param name="assembly">The assembly.</param> /// <returns>IEnumerable{`0}.</returns> /// <exception cref="Glass.Mapper.Configuration.ConfigurationException">Failed to load types {0}.Formatted(ex.LoaderExceptions.First().Message)</exception> protected IEnumerable <AbstractTypeConfiguration> LoadFromAssembly(Assembly assembly) { var configs = new List <AbstractTypeConfiguration>(); if (assembly != null) { try { var types = assembly.GetTypes(); foreach (var type in types) { var loader = new AttributeTypeLoader(type); var config = loader.Load().FirstOrDefault(); if (config != null) { configs.Add(config); } } } catch (ReflectionTypeLoadException ex) { throw new ConfigurationException( "Failed to load types {0}".Formatted(ex.LoaderExceptions.First().Message), ex); } } return(configs); }
/// <summary> /// Processes a specific assembly /// </summary> /// <param name="assembly">The assembly.</param> /// <returns>IEnumerable{`0}.</returns> /// <exception cref="Glass.Mapper.Configuration.ConfigurationException">Failed to load types {0}.Formatted(ex.LoaderExceptions.First().Message)</exception> protected IEnumerable <AbstractTypeConfiguration> LoadFromAssembly(Assembly assembly) { var configs = new List <AbstractTypeConfiguration>(); if (assembly != null) { try { var types = assembly.GetTypes(); foreach (var type in types) { if (AllowedNamespaces == null || AllowedNamespaces.Any(x => type.FullName.StartsWith(x))) { if (type.IsGenericTypeDefinition) { continue; } var loader = new AttributeTypeLoader(type); var config = loader.Load().FirstOrDefault(); if (config != null) { configs.Add(config); } } } } catch (ReflectionTypeLoadException ex) { throw new ConfigurationException( "Failed to load types {0}".Formatted(ex.LoaderExceptions.First().Message), ex); } } return(configs); }
/// <summary> /// Processes a specific assembly /// </summary> /// <param name="assembly">The assembly.</param> /// <returns>IEnumerable{`0}.</returns> /// <exception cref="Glass.Mapper.Configuration.ConfigurationException">Failed to load types {0}.Formatted(ex.LoaderExceptions.First().Message)</exception> protected IEnumerable<AbstractTypeConfiguration> LoadFromAssembly(Assembly assembly) { var configs = new List<AbstractTypeConfiguration>(); if (assembly != null) { try { var types = assembly.GetTypes(); foreach (var type in types) { var loader = new AttributeTypeLoader(type); var config = loader.Load().FirstOrDefault(); if (config != null) { configs.Add(config); } } } catch (ReflectionTypeLoadException ex) { throw new ConfigurationException( "Failed to load types {0}".Formatted(ex.LoaderExceptions.First().Message), ex); } } return configs; }
/// <summary> /// Processes a specific assembly /// </summary> /// <param name="assembly">The assembly.</param> /// <returns>IEnumerable{`0}.</returns> /// <exception cref="Glass.Mapper.Configuration.ConfigurationException">Failed to load types {0}.Formatted(ex.LoaderExceptions.First().Message)</exception> protected IEnumerable<AbstractTypeConfiguration> LoadFromAssembly(Assembly assembly) { var configs = new List<AbstractTypeConfiguration>(); if (assembly != null) { try { var types = assembly.GetTypes(); foreach (var type in types) { if(AllowedNamespaces == null || AllowedNamespaces.Any(x=> type.FullName.StartsWith(x))) { if (type.IsGenericTypeDefinition) { continue; } var loader = new AttributeTypeLoader(type); var config = loader.Load().FirstOrDefault(); if (config != null) { configs.Add(config); } } } } catch (ReflectionTypeLoadException ex) { throw new ConfigurationException( "Failed to load types {0}".Formatted(ex.LoaderExceptions.First().Message), ex); } } return configs; }