Originally posted by Ralf Jansen
View Post
Gruss
private static string CreateDbProviderFactoryEntry(string assemblyPath) { Assembly assembly = Assembly.LoadFile(assemblyPath); AssemblyName assemblyName = assembly.GetName(); AssemblyTitleAttribute assemblyTitleAttribute = (AssemblyTitleAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyTitleAttribute)); string title = (assemblyTitleAttribute != null) ? assemblyTitleAttribute.Title : assemblyName.Name; AssemblyDescriptionAttribute assemblyDescriptionAttribute = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyDescriptionAttribute)); string desciption = (assemblyDescriptionAttribute != null) ? assemblyDescriptionAttribute.Description : assemblyName.Name; foreach (Type type in assembly.GetTypes()) if (type.IsSubclassOf(typeof(System.Data.Common.DbProviderFactory))) return "<add name=\"" + title + "\" invariant=\"" + type.Namespace + "\" description=\"" + desciption + "\" type=\"" + type.AssemblyQualifiedName + "\" />"; throw new Exception("DbProviderFactory not found"); }
Comment