我已经使用DevArt的提供商针对Oracle数据库设置实体框架4.3。我在通过NUnit 2.6测试运行器中的单元测试项目连接数据库时遇到问题。有趣的是,我有一个ASP.NET MVC 3项目连接到它就好了。我在我的类库单元测试项目中创建了一个App.config,并将实体连接字符串信息复制到它。我错过了什么?实体框架4.3到Oracle:Web项目的作品,NUnit不
这里的实体连接信息(在相同的Web.config和App.config中):
<connectionStrings>
<add name="Entities" connectionString="metadata=res://*/Entities.MagellanDataModel.csdl|res://*/Entities.MagellanDataModel.ssdl|res://*/Entities.MagellanDataModel.msl;provider=Devart.Data.Oracle;provider connection string="User Id=theusername;Password=thepassword;Server=theTNSname"" providerName="System.Data.EntityClient" />
</connectionStrings>
这里的异常信息:
AppName.Tests.AccountRepositoryTests.GetByContactId:
System.Data.EntityException : The underlying provider failed on Open.
----> System.InvalidOperationException : Can not obtain Oracle client information
from registry. Make sure that Oracle Client Software is installed, or use
Direct mode of connecting to server.
注:Web和单元测试组件是设置为编译为Any CPU
。我在64位Windows 7上运行32位Oracle 10g数据库。我发现一篇文章似乎表明它与平台需要x86相关,但我的web项目设置为Any CPU
,并且工作正常。