简体   繁体   English

Microsoft Enterprise Library 6.0中的ODP.NET

[英]ODP.NET in Microsoft Enterprise Library 6.0

There are a couple of questions floating around about this, but none have been really answered. 关于此问题有两个问题,但是没有一个真正的答案。

Basically - is there currently an implementation of ODP.NET for enlib (6.0) currently being used? 基本上-当前是否正在使用针对enlib(6.0)的ODP.NET实现? Or will I have to go down the route of writing a mapping / custom DAO for ODP.NET? 还是我必须沿着为ODP.NET编写映射/自定义DAO的路线走下去?

The generic database can only get me so far, it falls flat with Oracle stored procedures (the dreaded 'Parameter discovery is not supported for connections using GenericDatabase. You must specify the parameters explicitly, or configure the connection to use a type deriving from Database that supports parameter discovery' error) 通用数据库只能解决我的问题,它与Oracle存储过程不兼容(可怕的“使用GenericDatabase的连接不支持参数发现。必须显式指定参数,或将连接配置为使用从数据库派生的类型,支持参数发现错误)

I am aware of the entlibcontrib project - but this seems to be on hold/dead as it has not had a new realease since 2011/entlib 5.0. 我知道entlibcontrib项目-但这似乎被搁置了,因为自2011 / entlib 5.0以来没有新的实现。

Any pointers, or advice about custom DAO development for entlib, would be appreciated. 任何有关entlib的自定义DAO开发的指针或建议,将不胜感激。

Here's our official stand on this: 这是我们对此的官方立场:

If you are working with an Oracle database, you can use the Oracle provider included with Enterprise Library and the ADO.NET Oracle provider, which requires you to reference or add the assembly System.Data.OracleClient.dll . 如果使用的是Oracle数据库,则可以使用Enterprise Library附带的Oracle提供程序和ADO.NET Oracle提供程序,这需要您引用或添加程序集System.Data.OracleClient.dll However, keep in mind that the OracleClient provider is deprecated in version 4.0 of the .NET Framework, and support for this provider is deprecated in Enterprise Library 6. Although support for the OracleClient provider is still included in Enterprise Library 6, for future development you should consider choosing a different implementation of the Database class that uses a different Oracle driver. 但是,请记住,在.NET Framework 4.0版中不建议使用OracleClient提供程序,在企业库6中不建议使用该提供程序。尽管对于将来的开发,企业库6中仍包含对OracleClient提供程序的支持。应该考虑选择使用不同Oracle驱动程序的Database类的不同实现。

I haven't come across an implementation of ODP.NET for EntLib6. 我还没有遇到过针对EntLib6的ODP.NET实现。 If you do end up updating the one available on EntLibContrib for v5.0, please post it to the contrib site for others to benefit from. 如果确实要更新EntLibContrib v5.0上可用的版本,请将其发布到contrib站点上,以使其他人受益。 Should be fairly straightforward, no major changes to DAAB in v6. 应该相当简单,在v6中对DAAB没有重大更改。

I wish I had a better answer for you, but at the end of the day it comes down to prioritization of stories for the release and this one wasn't high enough of the stackrank for my team to pick up. 我希望我能为您提供一个更好的答案,但是最终归结为发布故事的优先次序,而这对于我的团队来说还不够高。

We are successfully connecting to Oracle 11g using ODP.NET and the GenericDatabase object in the enterprise library. 我们已经使用ODP.NET和企业库中的GenericDatabase对象成功连接到Oracle 11g。

We had an issue running stored procedure in Oracle packages (forget what the exact error was, but we had some issue with the command being disposed of before it was actually used), and we made a small change to the enterprise library to deal with it. 我们在Oracle软件包中运行存储过程时遇到了一个问题(忘记确切的错误是什么,但是在实际使用该命令之前就已经抛弃了一些问题),并且我们对企业库进行了一些小的改动来处理它。

In SprocAccessor.cs, we modified 在SprocAccessor.cs中,我们修改了

public override IEnumerable<TResult> Execute(params object[] parameterValues)

to look like this 看起来像这样

public override IEnumerable<TResult> Execute(params object[] parameterValues)
{
    using (DbCommand command = Database.GetStoredProcCommand(procedureName))
    {            
        parameterMapper.AssignParameters(command, parameterValues);                
        //return base.Execute(command);  Removed 

        //foreach added by ngpojne.  This allows the command to be used before it is disposed of.
        foreach (TResult result in base.Execute(command))
        {
            yield return result;
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM