
|
导读public class DataProvider public static IDataProvider Instance() //use the cache because th... public class DataProvider { public static IDataProvider Instance() { //use the cache because the reflection used later is expensive Cache cache = System.Web.HttpContext.Current.Cache; if ( cache["IDataProvider"] == null ) (NameValueCollection)ConfigurationSettings.GetConfig("appSettings"); String assemblyPath = context[prefix + "DataProviderAssemblyPath"]; "DataProviderClassName"]; // assemblyPath presented in virtual form, must convert to physical path HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath + "/bin/" + assemblyPath); // Uuse reflection to store the constructor of the class that implements IWebForumDataProvider assemblyPath).GetType( className ).GetConstructor(new Type[0]), new CacheDependency( assemblyPath ) ); // could not locate DLL file Could not locate file: <code>" + assemblyPath + "</code> or could not locate class <code>" + className + "</code> in file."); ((ConstructorInfo)cache["IDataProvider"]).Invoke(null) ); |
温馨提示:喜欢本站的话,请收藏一下本站!