EF 配置Oracle数据库的具体操作方法
EF可以配置Oracle数据库,但不知道为什么一直配置不好。
其实可以使用使用NUGET管理程序包,自动配置数据库,但需要注意的时,需要安装两个包,而并不是一个,我一直以为时一个,但已启动程序就会出错。
安装后配置文件的主要的改变如下:
<configSections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> </configSections> <connectionStrings> <add name="DefaultConnection" providerName="Oracle.ManagedDataAccess.Client" connectionString="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.19.19.187)(PORT=6521))(CONNECT_DATA=(SERVICE_NAME=easa)));User ID=User;Password=Password;" /> </connectionStrings> <entityFramework> <defaultConnectionFactory type="Oracle.ManagedDataAccess.EntityFramework.OracleConnectionFactory, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> <providers> <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> </providers> </entityFramework> <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> <oracle.manageddataaccess.client> <version number="*"> <dataSources> <dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.19.19.187)(PORT=6521))(CONNECT_DATA=(SERVICE_NAME=easa))) " /> </dataSources> </version> </oracle.manageddataaccess.client>
oracle.manageddataaccess.client配置节的dataSource好像没有用
相关推荐
loveandroid0 2020-06-18
wintershii 2020-06-07
blncle 2020-05-09
小惠 2020-04-21
hxw0 2020-01-31
囧芝麻 2020-01-18
nan00zzu 2020-01-07
jusewe 2019-12-27
nan00zzu 2019-12-16
hufanglei00 2017-03-30
狗蛋的窝 2019-09-08
zhongzhiwei 2017-03-30
leiyanglove 2012-12-14
bluetears 2019-01-10
congdada 2019-06-26
兔子压倒窝边草 2019-06-25
boxue 2018-02-15
wlcome 2017-08-23