简体   繁体   English

C#.NET 4自包含的Oracle驱动程序部署

[英]C# .NET 4 Self-Contained Oracle Driver Deployment

I want to write and deploy some software without the need to install Oracle drivers on the users' workstations, rather, I would like to copy everything needed to a network location, and for the users to launch from there. 我想编写和部署某些软件,而无需在用户的工作站上安装Oracle驱动程序,相反,我想将所需的所有内容复制到网络位置,然后从那里启动用户。

I have successfully established an OracleConnection by deploying the following to the application's folder. 通过将以下内容部署到应用程序的文件夹,我已经成功建立了OracleConnection (I took these from instantclient-basiclite-nt-11.2.0.3.0 provided by Oracle ) (我从Oracle提供的instantclient-basiclite-nt-11.2.0.3.0中获取了这些信息)

oci.dll
ociw32.dll
orannzsbb11.dll 
oraocci11.dll
oraociicus11.dll

I have found this works with an LDAP Query to establish the DataSource= part of the connection string. 我发现这可用于LDAP查询以建立连接字符串的DataSource=部分。 The code I use is as follows - I hope this is useful to someone. 我使用的代码如下-我希望这对某人有用。

List<string> LDAPServers string OracleInstance List<string> LDAPServers string OracleInstance

    private string GetOracleNetDescriptor()
    {
        string result = null;

        foreach (string ldapserver in LDAPServers)
        {  
            try
            {
                DirectoryEntry de = new DirectoryEntry(String.Format("LDAP://{0}", ldapserver), null, null, AuthenticationTypes.Anonymous);

                DirectorySearcher ds = new DirectorySearcher(de);
                ds.PropertiesToLoad.Add("orclnetdescstring");
                ds.SearchScope = SearchScope.Subtree;
                ds.Filter = String.Format("(CN={0})", OracleInstance);

                SearchResult sr = ds.FindOne();

                if (sr != null)
                {
                    result = Encoding.Default.GetString(sr.Properties["orclnetdescstring"][0] as byte[]);
                    break;
                }

            }
            catch 
            {
                result = null;
            } 
        }

        if (result == null) 
            throw new Exception(String.Format("Failed To Identify Oracle Instance '{0}' From LDAP", OracleInstance)); 
        else
            return result;
    }

So far so good, however ... 到目前为止到目前为止还不错...

  1. The solution is currently dependent on a reference to the deprecated System.Data.OracleClient which I really need/want to avoid 该解决方案当前依赖于我确实需要/想要避免的对已弃用的System.Data.OracleClient的引用

  2. I would like to get access to some advanced features, such as Entity Framework. 我想访问一些高级功能,例如实体框架。

Can the panel advise ? 小组可以提出建议吗?

I would also appreciate any comments on the ldap code above as this is all work-in-progress. 我还要感谢上面对ldap代码的任何评论,因为这一切都在进行中。

Had the same problem with the deprecated provider. 弃用的提供程序也存在相同的问题。 I've made good expiriences with Devart dotConnect for Oracle: 我对Devart dotConnect for Oracle有了很好的经验:
http://www.devart.com/dotconnect/oracle/ http://www.devart.com/dotconnect/oracle/
It is not free of charge (and I'm not related to this company nor would I benefit in any kind). 它不是免费的(而且我与这家公司无关,也不会给我带来任何好处)。 It works with ADO.Net's DataTable and DataSet. 它与ADO.Net的DataTable和DataSet一起使用。 As some years passed since my last usage I don't know how well it integrates with EF. 自从我上次使用以来已经过去了数年,我不知道它与EF的集成程度如何。

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

相关问题 例如 C# 自包含 getter - C# Self-contained getter for instance 发布用于Linux体系结构的.NET Core C#自包含应用程序 - Publishing .NET Core C# self-contained application for linux architecture 将Javascript / JQuery存储在独立的C#类中 - Storing Javascript/JQuery in a Self-Contained C# class 在修剪的独立部署中定位包含的组件 - Locating included assemblies in trimmed self-contained deployment 如何在内部使用IronPython引用自包含的C#类库项目(Visual Studio 2010) - How to refer self-contained C# class library project with IronPython inside (Visual Studio 2010) 简单的自包含SNMP代理示例? (java / c#ideal) - Simple self-contained SNMP Agent example? (java/c# ideal) 如何创建一个用C#编写的独立,自包含的安装程序? - How to create a standalone, self-contained setup program written in C#? 如何发布引用另一个可执行文件的独立 C# 可执行文件? - How to publish a self-contained C# executable that references another executable? .NET 4.8 没有为 Linux 创建一个独立的文件 - .NET 4.8 not creating a self-contained file for Linux .NET Core 自包含发布引用 - 如何删除未使用的? - .NET Core self-contained publish references - how to remove unused?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM