无需安装Oracle客户端, .Net连接Oracle数据库配置文件

Nuget引用 Oracle.ManagedDataAccess包将自动添加

<!--Oracle ManagedDataAccess配置-->
    <oracle.manageddataaccess.client>
        <version number="*">
            <edmMappings>
                <edmNumberMapping>
                    <add NETType="int32" MinPrecision="1" MaxPrecision="38" DBType="number"/>
                </edmNumberMapping>
            </edmMappings>
            <dataSources>
                <dataSource alias="SampleDataSource"
                            descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.33)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=BKCYUNDEV)))"/>
            </dataSources>
        </version>
    </oracle.manageddataaccess.client>


     <system.data>
        <DbProviderFactories>
            <remove invariant="Oracle.ManagedDataAccess.Client"/>
            <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver"
              type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
        </DbProviderFactories>
    </system.data>

      <!--Ado.Net连接Oracle字符串 使用Oracle.ManangedDataAccess.dll-->
        <add name="ExpertDiagnosisEntityConnString"
             connectionString="DATA SOURCE=SampleDataSource;PERSIST SECURITY INFO=True;USER ID=myUserID;Password=myPassword;"
             providerName="Oracle.ManagedDataAccess.Client" />
posted @ 2017-06-29 09:20  WWMLee  阅读(2206)  评论(0编辑  收藏  举报