C#调用ibatisnet的DAO问题
fpcc 2012-08-15 12:16:41 调用DAO时出现一个错误,报“There is no DAO implementation found for class” ,DAO.config的配置如下:
<?xml version="1.0"?>
<daoConfig xmlns="http://ibatis.apache.org/dataAccess" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--Define the Provide Source File-->
<providers embedded="providers.config,TestMyBatisORM"/>
<!--Sql Server : SqlClient configuration-->
<context id="SqlMapDao" default="true">
<database>
<provider name="sqlServer2.0" />
<dataSource name="BaseCardDB" connectionString="data source=(local);database=BaseCardDB;user id=sa;password=123456;" />
</database>
</context>
<daoSessionHandler id="SqlMap">
<property name="embedded" value="SqlMap.config,TestMyBatisORM" />
</daoSessionHandler>
<daoFactory>
<dao interface="CustomerPersistencePI.InterFaces.ICustomerDao,CustomerPersistencePI."
implementation="CustomerPersistencePI.MapperDao.CustomerMapDao, CustomerPersistencePI"/>
<dao interface="CustomerPersistencePI.InterFaces.IProductMapDao,CustomerPersistencePI"
implementation="CustomerPersistencePI.MapperDao.ProductMapDao,CustomerPersistencePI"></dao>
</daoFactory>
<daoSessionHandler id="SqlMap">
<property name="embedded" value="SqlMap.config" />
</daoSessionHandler>
</daoConfig>
调用出错是在:
private static CustomerService _getcustomerService = new CustomerService();
private IDaoManager _getDaoManager = null;
private ICustomerDao _getbaseService = null;
public static SqlMapper _getsqlmaper = null;
public CustomerService()
{
#region Define the Base Map
_getDaoManager = ServiceConfig.GetInstance().DaoManager;
try
{
//There is no DAO implementation found for class问题--fjf
if (_getDaoManager != null)
_getbaseService = _getDaoManager.GetDao(typeof(ICustomerDao)) as ICustomerDao;
//_getbaseService = _getDaoManager.GetDao(typeof(CustomerMapDao)) as ICustomerDao;
}
catch (Exception e)
{
string x = e.Message.ToString();
}
网上找了好多方法都无法解决,不过有一个同样的例程在NET2中就没问题,目前出问题的是在VS2010的net4.0中。还有人说在3.5就可以,确实也验证过了,真是版本的原因吗?