抽象工厂类
///
/// 通过抽象的方式创建数据操作类的实例
///
public class AbstractFactory
{
private readonly static string NameSpace = ConfigurationManager.AppSettings["NameSpace"];
private readonly static string AssemblyPath = ConfigurationManager.AppSettings["AssemblyPath"];
private static IDAL.IUserInfoDAL CreateUserInfoDAL()
{
string fullClassName = NameSpace + ".UserInfoDAL";
return CreateInstance(fullClassName, AssemblyPath) as IDAL.IUserInfoDAL;
}
private static object CreateInstance(string fullClassName, string AssemblyPath)
{
var ass= Assembly.Load(AssemblyPath);
return ass.CreateInstance(fullClassName);
}
}