IEnterpriceInfo _interpriceDal = Activator.CreateInstance(
            Type.GetType(string.Format("SmartSoft.CMS.{0}.EnterpriceInfoDAL", System.Configuration.ConfigurationManager.AppSettings["DataBaseType"]))
            ) as IEnterpriceInfo;

解决方案 »

  1.   

    如果该类在当前dll以外的程序集中的时候,要加上dll。string.Format("SmartSoft.CMS.{0}.EnterpriceInfoDAL, SmartSoft.CMS.dll");红色部分就是举个栗子
      

  2.   

    Type.GetType(string.Format("SmartSoft.CMS.{0}.EnterpriceInfoDAL, namespace", System.Configuration.ConfigurationManager.AppSettings["DataBaseType"]))
      

  3.   

    这样也不行啊
    我Web.Config中是这样写的:
      <add key="DataBaseType" value="SmartSoft.CMS.SqlServerDAL"/>
    应该没问题的呀
      

  4.   

    不好意思应该是:<add key="DataBaseType" value="SqlServerDAL"/>
    这样应该可以获得SmartSoft.CMS.SqlServerDAL.EnterpriceInfoDAL这个命名空间的类型把,可以不行啊