问题描述
BLL引用:DALFactory、IDALSQLServer引用:IDAL、ModelDALFactory引用:IDAL代码:BLL:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Data;usingDALFactory;usingIDAL;namespaceBLL{publicstaticclassBLL_Department{privatestaticreadonlyIDAL.IDepartmenti;staticBLL_Department(){i=Factory.GetDepartmentAll();}publicstaticDataTableDepartment_GetALL(){try{returni.Department_GetAll();}catch(Exceptionex){throwex;//记录错误}}}}------------------------------------DALFactory:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Configuration;usingSystem.Reflection;usingSystem.Data;usingIDAL;namespaceDALFactory{publicstaticclassFactory{//读取使用的数据库类型所对应的项目名称privatestaticreadonlystringpath=ConfigurationManager.AppSettings["DALPath"];//创建继承于接口的具体数据层类的实例publicstaticIDAL.IDepartmentGetDepartmentAll(){stringdal_department=path+"DAL_Department";IDepartmenti=(IDAL.IDepartment)Assembly.Load(path).CreateInstance(dal_department);returni;}}}------------------IDAL:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Data;usingModel;namespaceIDAL{publicinterfaceIDepartment{DataTableDepartment_GetAll();DepartmentEntityDepartment_GetOne(intDepartmentID);intDepartment_Insert(stringName,stringDescription);intDepartment_Update(intDepartmentID,stringName,stringDescription);intDepartment_Delete(intDepartmentID);}}--------------------Web.config:<appSettings><addkey="DALPath"value="JieBookShop.SQLServer."/></appSettings>错误是,IDAL对象总是不能正确找到SQLServer的实例就是说无法动态加载程序集。。。。。。。我看别的代码和我的差不多,但是为什么我这样就错了阿。拜托帮忙看看吧,我实在是没分了,对不起了。