imp oracle错误3114,NHibernate配置使用Oracle时出错,谢谢帮看下,园豆用完了,抱歉!...

Nhibernate配置:

var cfg = newConfiguration();

cfg.SessionFactory()

.Proxy

.DisableValidation()

.Through()

.Named("Fluent.SessionFactory")

.GenerateStatistics()

.Using(EntityMode.Poco)

.ParsingHqlThrough()

.Integrate

.Using()

.AutoQuoteKeywords()

.LogSqlInConsole()

.EnableLogFormattedSql()

.Connected

.Through()

.By()

.ByAppConfing("ConnectionString")

.CreateCommands

.Preparing()

.WithTimeout(10)

.AutoCommentingSql()

.WithMaximumDepthOfOuterJoinFetching(11)

.WithHqlToSqlSubstitutions("true 1, false 0, yes 'Y', no 'N'");

_sessionFactory= cfg.BuildSessionFactory();

调用的时候,报出错误:

System.TypeInitializationException: “Fluent.Infrastructure.Domain.NhibernateRepository.OracleSessionFactoryHelper”的类型初始值设定项引发异常。 ---> NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.OracleDataClientDriver, NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4. ---> System.Reflection.TargetInvocationException: 调用的目标发生了异常。 --->System.ArgumentException: 找不到请求的 .Net Framework Data Provider。可能没有安装。

在 System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)

后台根据网上的资料。补充了app.config的配置信息:

app.config:(添加如下配置)

开始报另一个错误:

:在配置了DbProviderFactories的情况下:

System.Reflection.TargetInvocationException: 调用的目标发生了异常。 ---> System.IO.FileLoadException: 未能加载文件或程序集“oracle.dataaccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342”或它的某一个依赖项。给定程序集名称或基本代码无效。 (异常来自 HRESULT:0x80131047)

但是GAC中的程序集显示正常:

c7023308f94771a2b464960e8910f11f.png

网上找了很多资料,过都没有找到可以解决的办法,还是报这个异常。

其中一些资料的地址:

麻烦使用过oracle相关的配置的兄弟姐妹帮帮忙。谢谢,比较紧急。

本机环境:

win7  64位

没有安装Oracle环境  ,GAC安装了64位相关的odp.net程序集。

测试项目执行时报上述错误。没有直接引用程序集,而是直接拷贝到bin目录下的。

注:我这个是在MSTesting项目的单元测试下执行抛出的异常。

后台我建 了个MVC项目中,一切正常,非常感谢大家的回复和启发。不过还是希望帮我看看如何能在MSTesting中正确的配置运行ODP.net

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值