readme.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. Oracle.ManagedDataAccess.EntityFramework Nuget Package Version 12.1.022 README
  2. ==============================================================================
  3. Release 12.1.0.2.2 for RDBMS 12.1.0.2 Bundle Patch 6 Production
  4. Release Notes: Oracle Data Provider for .NET, Managed Driver for Entity Framework
  5. June 2015
  6. Copyright (c) Oracle Corporation 2015
  7. This document provides information that supplements the Oracle Data Provider for .NET (ODP.NET) for Entity
  8. Framework documentation. You have downloaded Oracle Data Provider for .NET for Entity Framework from Oracle,
  9. the license agreement to which is available at
  10. http://www.oracle.com/technetwork/licenses/distribution-license-152002.html
  11. TABLE OF CONTENTS
  12. *New Features
  13. *Installation and Configuration Steps
  14. *Installation Changes
  15. *Documentation Corrections and Additions
  16. *Entity Framework Tips, Limitations, and Known Issues
  17. Note: Please consult the ODP.NET, Managed Driver NuGet README at packages\Oracle.ManagedDataAccess.<version>
  18. for more information about the component.
  19. Note: The 32-bit "Oracle Developer Tools for Visual Studio" download from http://otn.oracle.com/dotnet is
  20. required for Entity Framework design-time features. This NuGet download does not enable design-time tools; it
  21. only provides run-time support. This version of ODP.NET for Entity Framework supports Oracle Database version
  22. 10.2 and higher.
  23. New Features since Oracle.ManagedDataAccess.EntityFramework Nuget Package Version 12.1.021
  24. ==========================================================================================
  25. None
  26. Installation and Configuration Steps
  27. ====================================
  28. The downloads are NuGet packages that can be installed with the NuGet Package Manager. These instructions apply
  29. to install ODP.NET, Managed Driver for Entity Framework.
  30. 1. Un-GAC any existing ODP.NET for Entity Framework 12.1.0.2 versions you have installed. For example, if you
  31. plan to use only the ODP.NET, Managed Driver for Entity Framework, only un-GAC existing managed ODP.NET for
  32. Entity Framework 12.1.0.2 versions then.
  33. 2. In Visual Studio 2012 or 2013, open NuGet Package Manager from an existing Visual Studio project.
  34. 3. Install the NuGet package from an OTN-downloaded local package source or from nuget.org.
  35. From Local Package Source
  36. -------------------------
  37. A. Click on the Settings button in the lower left of the dialog box.
  38. B. Click the "+" button to add a package source. In the Source field, enter in the directory location where the
  39. NuGet package(s) were downloaded to. Click the Update button, then the Ok button.
  40. C. On the left side, under the Online root node, select the package source you just created. The ODP.NET for
  41. Entity Framework NuGet package will appear.
  42. From Nuget.org
  43. --------------
  44. A. In the Search box in the upper right, search for the package with id,
  45. "Oracle.ManagedDataAccess.EntityFramework". Verify that the package uses this unique ID to ensure it is the
  46. offical Oracle Data Provider for .NET, Managed Driver for Entity Framework downloads.
  47. B. Select the package you wish to install.
  48. 4. Click on the Install button to select the desired NuGet package(s) to include with the project. Accept the
  49. license agreement and Visual Studio will continue the setup. ODP.NET, Managed Driver will be installed
  50. automatically as a dependency for ODP.NET, Managed Driver for Entity Framework.
  51. 5. Open the app/web.config file to configure the ODP.NET connection string and local naming parameters
  52. (i.e. tnsnames.ora). Below is an example of configuring the local naming parameters:
  53. <oracle.manageddataaccess.client>
  54. <version number="*">
  55. <dataSources>
  56. <!-- Customize these connection alias settings to connect to Oracle DB -->
  57. <dataSource alias="MyDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL))) " />
  58. </dataSources>
  59. </version>
  60. </oracle.manageddataaccess.client>
  61. 6. Modify the app/web.config file's connection string to create a DbContext your Entity Framework application
  62. will use. Below is an example of a configured DbContext.
  63. <connectionStrings>
  64. <add name="OracleDbContext" providerName="Oracle.ManagedDataAccess.Client"
  65. connectionString="User Id=hr;Password=hr;Data Source=MyDataSource"/>
  66. </connectionStrings>
  67. After following these instructions, ODP.NET, Managed Driver for Entity Framework is now configured and ready
  68. to use.
  69. NOTE: ODP.NET, Managed Driver may require its own configuration. Please consult the component's README
  70. at packages\Oracle.ManagedDataAccess.<version>.
  71. Installation Changes
  72. ====================
  73. The following app/web.config entries are added by including the "Official Oracle ODP.NET, Managed Entity Framework Driver"
  74. NuGet package to your application.
  75. 1) Entity Framework
  76. The following entry is added to enable Entity Framework to use Oracle.ManagedDataAccess.dll for executing Entity
  77. Framework related-operations, such as Entity Framework Code First and Entity Framework Code First Migrations against
  78. the Oracle Database.
  79. <configuration>
  80. <entityFramework>
  81. <providers>
  82. <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
  83. </providers>
  84. </entityFramework>
  85. </configuration>
  86. 2) Connection String
  87. The following entry is added to enable the classes that are derived from DbContext to be associated with a connection
  88. string instead to associating the derived class with a connection string programmatically by passing it via its
  89. constructor. The name of "OracleDbContext" should be changed to the class name of your class that derives from DbContext.
  90. In addition, the connectionString attribute should be modified properly to set the "User Id", "Password", and
  91. "Data Source" appropriately with valid values.
  92. <configuration>
  93. <connectionStrings>
  94. <add name="OracleDbContext" providerName="Oracle.ManagedDataAccess.Client" connectionString="User Id=oracle_user;Password=oracle_user_password;Data Source=oracle" />
  95. </connectionStrings>
  96. </configuration>
  97. Documentation Corrections and Additions
  98. =======================================
  99. This section contains information that corrects or adds to existing ODP.NET documentation relevant to Entity Framework.
  100. The existing ODP.NET documentation can be found here:
  101. http://docs.oracle.com/cd/E56485_01/index.htm
  102. Custom Entity Data Model (EDM) Type Mapping Not Applied to Generated Complex Types
  103. ---
  104. When using the EDM wizard to create a complex type from a function import, any custom EDM type mappings specified will
  105. not be applied. The EDM wizard uses the default type mappings and the only known workaround is to manually edit the
  106. resulting complex type. After the complex type is generated any type declaration (field, property, constructor parameter,
  107. etc.) in the complex object which has an undesired type (such as Decimal rather than Boolean) should be manually edited
  108. to be of the desired type.
  109. Entity Framework Code First: Code-Based Migrations With No Supporting Code Migration File
  110. ---
  111. When using code-based migrations with the Entity Framework provider, the migration history table may be dropped if no
  112. supporting code migration file existed prior to updating the database.
  113. Workaround: Ensure the supporting code migration file has been added prior to updating the database.
  114. The following steps can remove the migration history table:
  115. 1. Execute application to create database objects
  116. 2. Enable-Migrations
  117. 3. Make code change to POCO
  118. 4. Update-Database
  119. The workaround is to ensure code file is created:
  120. 1. Execute application to create database objects
  121. 2. Enable-Migrations
  122. 3. Make code change to POCO
  123. 4. Add-Migration (This step will create the necessary code migration file).
  124. 5. Update-Database
  125. Entity Framework Tips, Limitations, and Known Issues
  126. ====================================================
  127. This section contains Entity Framework related information that pertains to both ODP.NET, Managed Driver and ODP.NET,
  128. Unmanaged Driver.
  129. 1. Interval Day to Second and Interval Year to Month column values cannot be compared to literals in a WHERE clause of
  130. a LINQ to Entities or an Entity SQL query.
  131. 2. LINQ to Entities and Entity SQL (ESQL) queries that require the usage of SQL APPLY in the generated queries will
  132. cause SQL syntax error(s) if the Oracle Database being used does not support APPLY. In such cases, the inner exception
  133. message will indicate that APPLY is not supported by the database.
  134. 3. ODP.NET does not currently support wildcards that accept character ranges for the LIKE operator in Entity SQL
  135. (i.e. [] and [^]). [Bug 11683837]
  136. 4. Executing LINQ or ESQL query against tables with one or more column names that are close to or equal to the maximum
  137. length of identifiers (30 bytes) may encounter "ORA-00972: identifier is too long" error, due to the usage of alias
  138. identifier(s) in the generated SQL that exceed the limit.
  139. 5. An "ORA-00932: inconsistent datatypes: expected - got NCLOB" error will be encountered when trying to bind a string
  140. that is equal to or greater than 2,000 characters in length to an XMLType column or parameter. [Bug 12630958]
  141. 6. An "ORA-00932 : inconsistent datatypes" error can be encountered if a string of 2,000 or more characters, or a byte
  142. array with 4,000 bytes or more in length, is bound in a WHERE clause of a LINQ/ESQL query. The same error can be
  143. encountered if an entity property that maps to a BLOB, CLOB, NCLOB, LONG, LONG RAW, XMLTYPE column is used in a WHERE
  144. clause of a LINQ/ESQL query.
  145. 7. An "Arithmetic operation resulted in an overflow" exception can be encountered when fetching numeric values that
  146. have more precision than what the .NET type can support. In such cases, the LINQ or ESQL query can "cast" the value
  147. to a particular .NET or EDM type to limit the precision and avoid the exception. This approach can be useful if the
  148. LINQ/ESQL query has computed/calculated columns which will store up to 38 precision in Oracle, which cannot be
  149. represented as .NET decimal unless the value is casted.
  150. 8. Oracle Database treats NULLs and empty strings the same. When executing string related operations on NULLS or empty
  151. strings, the result will be NULL. When comparing strings with NULLs, use the equals operator (i.e. "x == NULL") in the
  152. LINQ query, which will in turn use the "IS NULL" condition in the generated SQL that will appropriately detect NULL-ness.
  153. 9. If an exception message of "The store provider factory type 'Oracle.ManagedDataAccess.Client.OracleClientFactory'
  154. does not implement the IServiceProvider interface." is encountered when executing an Entity Framework application with
  155. ODP.NET, the machine.config requires and entry for ODP.NET under the <DbProviderFactories> section. To resolve this
  156. issue by adding an entry in the machine.config, reinstall ODAC.
  157. 10. Creating a second instance of the context that derives from DbContext within an application and executing methods
  158. within the scope of that context that result in an interaction with the database may result in unexpected recreation of
  159. the database objects if the DropCreateDatabaseAlways database initializer is used.
  160. More Informations: https://entityframework.codeplex.com/workitem/2362
  161. Known Workarounds:
  162. - Use a different database initializer,
  163. - Use an operating system authenticated user for the connection, or
  164. - Include "Persist Security Info=true" in the connection string (Warning: Turning on "Persist Security Info" will cause
  165. the password to remain as part of the connection string).