[英]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 ... 到目前为止到目前为止还不错...
The solution is currently dependent on a reference to the deprecated System.Data.OracleClient
which I really need/want to avoid 该解决方案当前依赖于我确实需要/想要避免的对已弃用的
System.Data.OracleClient
的引用
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.