public void CanTakeUnqualifiedType() { var testType = typeof (Category); var typeAssemblyHolder = new TypeAssemblyHolder(testType.FullName); Assert.IsFalse(typeAssemblyHolder.IsAssemblyQualified); Assert.AreEqual(testType.FullName, typeAssemblyHolder.GetTypeName()); Assert.AreEqual(null, typeAssemblyHolder.GetAssemblyName()); }
public void CanTakeUnqualifiedGenericType() { var testType = typeof (TestGenericObject<int, string>); var tah = new TypeAssemblyHolder(testType.FullName); Assert.IsFalse(tah.IsAssemblyQualified); Assert.AreEqual(testType.FullName, tah.GetTypeName()); Assert.AreEqual(null, tah.GetAssemblyName()); }
private static Type LoadTypeDirectlyFromAssembly(TypeAssemblyHolder typeInfo) { Type type = null; var assembly = Assembly.Load(typeInfo.GetAssemblyName()); if (assembly != null) type = assembly.GetType(typeInfo.GetTypeName(), true, true); return type; }
private static Type LoadTypeByIteratingOverAllLoadedAssemblies(TypeAssemblyHolder typeInfo) { Type type = null; var assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (var assembly in assemblies) { type = assembly.GetType(typeInfo.GetTypeName(), false, false); if (type != null) break; } return type; }
private static Type LoadTypeDirectlyFromAssembly(TypeAssemblyHolder typeInfo) { Type type = null; var assembly = Assembly.Load(typeInfo.GetAssemblyName()); if (assembly != null) { type = assembly.GetType(typeInfo.GetTypeName(), true, true); } return(type); }
private static Type LoadTypeByIteratingOverAllLoadedAssemblies(TypeAssemblyHolder typeInfo) { Type type = null; var assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (var assembly in assemblies) { type = assembly.GetType(typeInfo.GetTypeName(), false, false); if (type != null) { break; } } return(type); }