Oracle EF5 Upgrade EF6

Source: Internet
Author: User

"Configuring the System Environment"

Follow the official documentation to download and install the EF6 plugin, Oracle EF Visual Studio plugin, as detailed below:

https://msdn.microsoft.com/en-us/data/dn469466
https://msdn.microsoft.com/en-us/data/jj730568
Http://www.oracle.com/technetwork/topics/dotnet/downloads/install121021-2389380.html

"Configuring the Engineering Environment"

Add the following database provider under the Configuration node in Web. config:

<entityFramework>    <defaultconnectionfactory type= " System.Data.Entity.Infrastructure.LocalDbConnectionFactory, entityframework ">      <parameters>        <parameter value= "v11.0"/>      </parameters>    </defaultConnectionFactory>    < providers>      <provider invariantname= "Oracle.ManagedDataAccess.Client" type= " Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework "/ >    </providers>  </entityFramework>

The compilation succeeds and the run will find a large heap of type mismatch errors.

If the data model is regenerated from database first, the data type of the model is changed and EF6 is more rigorous than the EF5 data type, such as:

EF5 Number (3) short

EF6 Number (3) Byte

This does not meet our needs in some cases, as long as you add the following configuration under Config node in app.

<oracle.manageddataaccess.client>    <version number= "*" >      <edmMappings>        < edmnumbermapping>          <add nettype= "Int16" minprecision= "1" maxprecision= "5" dbtype= "number"/>        </ edmnumbermapping>      </edmMappings>    </version>  </oracle.manageddataaccess.client >

If you see the above configuration, can we configure number (1) as bool? If you need it.

"Oracle EF database Read and write separation"

I upgraded to EF6 is to read and write the separation, EF6 added dbcommandinterceptor filter, through the filter we can record the execution of the script, but also to do the automatic read and write separation, related please refer to two people's blog.

1. http://www.cnblogs.com/lori/p/4208974.html

2. http://www.cnblogs.com/cjw0511/p/4391092.html

about using which, look at personal needs, the two basic almost.

The first one creates a new connection each time it is read, so it is equivalent to multiple connections when read multiple times.

The second kind reads the connection to read, writes the connection to write, the transaction starts the transliteration, but at present the transaction processing still has a bug

Either way, if you are reading and writing in a single business process, it is recommended that you create two DB instances to avoid having to go through the main library or to cause read-write alternating close to open.

Oracle EF5 Upgrade EF6

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.