IBatis.NET使用问题
在用IBatis的过程中我有个问题请教,通常我们将配置文件信息(如:providers.config和SqlMap.config)放在默认的地方,WinForm放在应用系统根目录下,可是在创建ISqlMapper实例的时候会出错。我的providers.config和SqlMap.config放在同一目录, SqlMap.config中大致这样配置:
<?xml version= "1.0 " encoding= "utf-8 "?>
<sqlMapConfig
xmlns= "http://ibatis.apache.org/dataMapper "
xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance ">
<settings>
<setting useStatementNamespaces= "false "/>
<setting cacheModelsEnabled= "true "/>
<setting validateSqlMap= "false "/>
</settings>
<providers resource= "providers.config "/>
<!-- Database connection information -->
<database>
<provider name= "sqlServer1.1 "/>
<dataSource name= "iBatisTutorial " connectionString= "server=.;User ID=sa;Password=123456;database=IBatis "/>
</database>
<sqlMaps>
<sqlMap resource= "Maps/Student.xml "/>
</sqlMaps>
</sqlMapConfig> ......
而在实例化的时候
private static void InitMapper()
{
ConfigureHandler handler = new ConfigureHandler(Configure);
DomSqlMapBuilder builder = new DomSqlMapBuilder();
FileInfo file = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + @ "Config\SqlMap.config ");
_mapper = builder.ConfigureAndWatch(file, handler);
}
在执行到最后_mapper = builder.ConfigureAndWatch(file, handler)的时候会出错,请指教,谢谢!
------解决方案--------------------可能是配置文件有问题吧
具体啥错误,谁也猜不到~