找不到 iBatis.NET SqlMap.config 文件

发布于 2024-08-11 05:44:25 字数 421 浏览 6 评论 0原文

我在一个非常简单的测试项目(VS 2008)中使用 iBatis.NET。当我运行该套件并实例化 Mapper 时,打开 SqlMap.config 时会弹出 FileNotFoundException。 iBatis.NET查找该文件的路径是“当前TestResults文件夹\Out”。当然,该文件不会复制到那里,因此 Mapper 构造函数会失败。

我一定完全误解了发生了什么,因为我无法在 SO 或整个网络上找到任何信息来表明我如何解决这个问题。我确实遇到了一些与 iBatis.NET 无关的情况,其中向用户建议的解决方案是在 .testrunco​​nfig 文件中将“启用部署”设置为“关闭”,以强制 VS 从 bin\Debug 运行测试。

然而,在我走这条路之前,我很好奇其他人在测试项目中使用 iBatis.NET 时做了什么。我有一种不愉快的感觉,觉得这个决议是微不足道的。

I am using iBatis.NET in a very simple test project (VS 2008). When I run the suite and the Mapper is instantiated a FileNotFoundException pops up on opening SqlMap.config. The path where iBatis.NET looks for this file is "the current TestResults folder \ Out". Naturally, the file isn't copied there so the Mapper constructor fails.

I must completely misunderstand what is going on because I have been unable to find any information on SO or the web at large to indicate how I could remedy the problem. I did run across a couple of situations unrelated to iBatis.NET where the solution suggested to the user was to set "Enable Deployment" to "off" in the .testrunconfig file to force VS to run the tests from bin\Debug.

However, before I go down that avenue I am curious to know what others have done when using iBatis.NET in a test project. I have the unpleasant feeling that the resolution is trivial.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泪痕残 2024-08-18 05:44:26

默认情况下,iBATIS.NET 将在当前目录中查找映射配置文件。正如你所说,该文件不存在。解决特定问题的最快方法是指示 Visual Studio 将 SqlMap.config 文件复制到输出文件夹,作为构建项目的一部分。

为此,请在解决方案资源管理器中右键单击 SqlMap.config 文件并选择“属性”。在属性选项板中,查找“复制到输出文件夹”并选择“如果较新则复制”。

除非我误解了你的情况,否则我相信这会起作用。

By default iBATIS.NET will look in the current directory for the map config file. As you say, the file is not there. The quickest way to solve your particular problem is to instruct Visual Studio to copy the SqlMap.config file to the output folder as part of building the project.

To do this, in the Solution Explorer, right-click on the SqlMap.config file and select Properties. In the property palette, look for Copy to Output Folder and select Copy If Newer.

Unless I misunderstand your situation, I believe this will work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文