日期:2014-05-17 浏览次数:20421 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Zjgcxx.DALFactory
{
public class DALFactory
{
public static readonly string DALPath = System.Configuration.ConfigurationSettings.AppSettings["DALPath"];
public static readonly string DALHZ = System.Configuration.ConfigurationSettings.AppSettings["HZ"];
/// <summary>
/// 创建实例
/// </summary>
/// <param name="assemblyPath"></param>
/// <param name="objType"></param>
/// <returns></returns>
public static object CreateDAL(string assemblyPath, string objType)
{
var cacheDAL = DALCache.GetDAL(objType);
if (cacheDAL == null)
{
cacheDAL = Assembly.Load(assemblyPath).CreateInstance(objType); //此句提示出错
DALCache.SaveDAL(objType, cacheDAL);
}
return cacheDAL;
}
}
}
using System;
using Zjgcxx.IDAL;
namespace Zjgcxx.DALFactory
{
public class Web_userDALFactory : DALFactory
{
/// <summary>
/// 获取 Web_user 的具体实例
/// </summary>
/// <returns></returns>
public static IWeb_userDAL Create()
{
//从配置中获取 sql、oracle 还是 EF&nbs