/// <summary> /// Throws exception says that given type was not found in any accessible assembly /// </summary> /// <param name="assemblyCatalog">An <see cref="IAssemblyCatalog"/> instance.</param> /// <param name="type">Type that was not found</param> public static void ThrowTypeNotFound(IAssemblyCatalog assemblyCatalog, string type) { throw new NotSupportedException(string.Format( "Unable to discover CLR Type for model by the name of {0}.\n\nTry using a fully qualified type name and ensure that the assembly is added to the configuration file.\n\nCurrent IAssemblyCatalog assemblies:\n\t{1}.", type, assemblyCatalog.GetAssemblies().Select(a => a.FullName).Aggregate((n1, n2) => n1 + "\n\t" + n2))); }
/// <summary> /// Throws exception says that given type was not found in any accessible assembly /// </summary> /// <param name="assemblyCatalog">An <see cref="IAssemblyCatalog"/> instance.</param> /// <param name="type">Type that was not found</param> public static void ThrowTypeNotFound(IAssemblyCatalog assemblyCatalog, string type) { throw new NotSupportedException(string.Format( "Unable to discover CLR Type for model by the name of {0}.\n\nTry using a fully qualified type name and ensure that the assembly is added to the configuration file.\n\nCurrent IAssemblyCatalog assemblies:\n\t{1}.", type, assemblyCatalog.GetAssemblies().Select(a => a.FullName).Aggregate((n1, n2) => n1 + "\n\t" + n2))); }
private IReadOnlyCollection <Type> GetTypesAssignableTo(Type type) { return(assemblyCatalog.GetAssemblies() .SelectMany(assembly => assembly.SafeGetTypes()) .Where(type.IsAssignableFrom) .Where(t => !t.GetTypeInfo().IsAbstract).ToArray()); }
public IServiceProvider Start() { var assemblies = _assemblyCatalog.GetAssemblies(); var entryModule = _options.Value.EntryModule; if (entryModule == null) { throw new ArgumentNullException(nameof(entryModule)); } var modules = _moduleLoader.GetSortedModules(assemblies, entryModule); return(StartInternal(_assemblyCatalog, modules)); }
/// <summary> /// Gets all <see cref="Assembly"/> instances using the <see cref="AssemblyResolveStrategies.All"/> strategy. /// </summary> /// <param name="assemblyCatalog">The <see cref="IAssemblyCatalog"/> instance that the assemblies should be reolved from.</param> /// <returns>An <see cref="IReadOnlyCollection{T}"/> of <see cref="Assembly"/> instances.</returns> public static IReadOnlyCollection <Assembly> GetAssemblies(this IAssemblyCatalog assemblyCatalog) { return(assemblyCatalog.GetAssemblies(AssemblyResolveStrategies.All)); }
public TypeCatalog(IAssemblyCatalog assemblyCatalog) { Check.NotNull(assemblyCatalog, nameof(assemblyCatalog)); this.assemblies = new Lazy <IReadOnlyCollection <Assembly> >(() => assemblyCatalog.GetAssemblies().ToArray()); }