比如我现在数据库表名叫 T_Link,然后对应的值对象是
T_Link.cs
同时我在SqlMap.config里挂接
<sqlMaps>
<sqlMap resource="XML/T_Link.xml"/>
</sqlMaps>
所有的config文件和XML目录都在项目的输出文件夹(ProjectName\bin\Debug\xxxxx)下。用1.2.1就没有问题。但是用1.3就提示如下错误信息。
************** Exception Text **************
IBatisNet.Common.Exceptions.ConfigurationException:
- The error occurred while loading SqlMap.
- The error occurred in <sqlMap resource="XML/T_Link.xml"
xmlns="http://ibatis.apache.org/dataMapper" />. --->
System.NullReferenceException: Object reference not set to an instance
of an object.
at
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureSqlMap()
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize()
at
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean
isCallFromDao)
--- End of inner exception stack trace ---
at
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean
isCallFromDao)
at
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(String
resource, ConfigureHandler configureDelegate)
at IBatisNet.DataMapper.Mapper.InitMapper()
at IBatisNet.DataMapper.Mapper.Instance()
at iBatis13.Form1.button1_Click(Object sender, EventArgs e) in F:\My
Document\Visual Studio 2005\Projects\iBatis13\iBatis13\Form1.cs:line 24
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
iBatisNet
被Apache升格为一级项目后我只在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" >
为什么同样的代码换包就不行了呢?在网上搜索了半天也没有找到关于1.3配置的不同,求高手指点。
没用到这个呢。我测试的时候用的是最最简单的配置。而且很诡异的是,我在同一个工程里。用1.2.1的iBatisNet包就没问题。然后当场修改该工程引用的iBatisNet包为1.3.1就提示如上错误。代码、配置什么的都不改。
对了。可有配置成功的1.3的iBatisNet读写数据库的小例子呢?我对比参考一下就好。
呃。我的邮箱就是这个gmail啦。多谢多谢。
然后发现项目里的两个工程其中Web这一个显示为unavailable...
我的VS 2005版本号为 Version 8.0.50727.42 (RTM.050727-4200)
Framework版本号为 Version 2.0.50727
用的公司订购的正版MSDN装的。
注意:安装之前,请先打上 Microsoft Visual Studio 2005 –
Update to Support Web Application Projects 补丁。下载地址:
http://download.microsoft.com/download/8/0/8/8086c312-16b1-4e54-a4cc-80a6c171112e/VS80-KB915364-X86-ENU.exe
[Last Modified By Admin, at 2006-05-10 16:02:33]