static Assembly[] GetCustomReferencedAssemblies() { List <Assembly> assemblies = new List <Assembly>(); if (GenericResolverInstaller.CallingAssembly.FullName != typeof(ServiceHost).Assembly.FullName && GenericResolverInstaller.CallingAssembly.FullName != typeof(GenericResolverInstaller).Assembly.FullName) { assemblies.AddRange(GetCustomReferencedAssemblies(GenericResolverInstaller.CallingAssembly)); } if (Assembly.GetEntryAssembly() != null) { if (Assembly.GetEntryAssembly().FullName != GenericResolverInstaller.CallingAssembly.FullName) { assemblies.AddRange(GetCustomReferencedAssemblies(Assembly.GetEntryAssembly())); } } else { if (GenericResolverInstaller.IsWebProcess()) { foreach (Assembly assembly in GenericResolverInstaller.GetWebAssemblies()) { assemblies.AddRange(GetCustomReferencedAssemblies(assembly)); } } else { foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies().Where(domainAssembly => IsDomainAssembly(domainAssembly))) { assemblies.AddRange(GetCustomReferencedAssemblies(assembly)); } } } return(assemblies.ToArray()); }
//Static helpers static Type[] ReflectTypes() { Assembly[] assemblyReferecnes = GetCustomReferencedAssemblies(); List <Type> types = new List <Type>(); foreach (Assembly assembly in assemblyReferecnes) { Type[] typesInReferencedAssembly = GetTypes(assembly); types.AddRange(typesInReferencedAssembly); } //MTM: Redundant? if (GenericResolverInstaller.CallingAssembly.FullName != typeof(ServiceHost).Assembly.FullName && GenericResolverInstaller.CallingAssembly.FullName != typeof(GenericResolverInstaller).Assembly.FullName) { Type[] typesInCallingAssembly = GetTypes(GenericResolverInstaller.CallingAssembly, false); types.AddRange(typesInCallingAssembly); } if (Assembly.GetEntryAssembly() != null) { if (Assembly.GetEntryAssembly().FullName != GenericResolverInstaller.CallingAssembly.FullName) { Type[] typesInEntryAssembly = GetTypes(Assembly.GetEntryAssembly(), false); types.AddRange(typesInEntryAssembly); } } else { if (GenericResolverInstaller.IsWebProcess()) { foreach (Assembly assembly in GenericResolverInstaller.GetWebAssemblies()) { Type[] typesInWebAssembly = GetTypes(assembly, false); types.AddRange(typesInWebAssembly); } } else { foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies().Where(domainAssembly => IsDomainAssembly(domainAssembly))) { Type[] typesInDomainAssembly = GetTypes(assembly, false); types.AddRange(typesInDomainAssembly); } } } return(types.ToArray()); }
//Static helpers static Type[] ReflectTypes() { Assembly[] assemblyReferecnes = GetCustomReferencedAssemblies(); List <Type> types = new List <Type>(); foreach (Assembly assembly in assemblyReferecnes) { Type[] typesInReferencedAssembly = GetTypes(assembly); types.AddRange(typesInReferencedAssembly); } if (GenericResolverInstaller.CallingAssembly.FullName != typeof(ServiceHost).Assembly.FullName && GenericResolverInstaller.CallingAssembly.FullName != typeof(GenericResolverInstaller).Assembly.FullName) { Type[] typesInCallingAssembly = GetTypes(GenericResolverInstaller.CallingAssembly, false); types.AddRange(typesInCallingAssembly); } if (Assembly.GetEntryAssembly() != null) { if (Assembly.GetEntryAssembly().FullName != GenericResolverInstaller.CallingAssembly.FullName) { Type[] typesInEntryAssembly = GetTypes(Assembly.GetEntryAssembly(), false); types.AddRange(typesInEntryAssembly); } } else { Debug.Assert(GenericResolverInstaller.IsWebProcess()); foreach (Assembly assembly in GenericResolverInstaller.GetWebAssemblies()) { Type[] typesInWebAssembly = GetTypes(assembly, false); types.AddRange(typesInWebAssembly); } } return(types.ToArray()); }