Use of Oracle. manageddataaccess + ef

Source: Internet
Author: User

1. http://www.oracle.com/technetwork/database/windows/downloads/odpmbeta-1696432.html download Oracle driver, this is managed version.

2. After the installation is complete, you can see Oracle-related tools in vs2012, which is much easier to use than PLSQL.

3. Just like using SQL to create a data entity model, let alone orqcel.

We recommend that you enter the user name, password, IP address, and Sid in EZ connect mode.

 

4. The code usage is the same as before.

Private void window_loaded (Object sender, routedeventargs E)
{
Try
{
Entities en = new entities ();
VaR DB = en. y_xmk.tolist ();
This. datacontext = dB;
}
Catch (exception ex)
{
MessageBox. Show (ex. Message );
}
}

5. Run: An error occurred.

The specified storage zone provider cannot be found in the configuration or is invalid.

 

6. Solution

According to the instructions on the internet, I tried to change the config file.

Reference: http://blog.csdn.net/liufan76/article/details/3173282

<System. Data>
<Dbproviderfactories>
<Remove invariant = "oracle. manageddataaccess. Client"/>
<Add name = "ODP. net, managed driver "invariant =" oracle. manageddataaccess. client "Description =" ORACLE data provider. net, managed driver "type =" oracle. manageddataaccess. client. oracleclientfactory, Oracle. manageddataaccess, version = 4.112.3.60, culture = neutral, publickeytoken = 89b483f429c47342 "/>
</Dbproviderfactories>
</System. Data>

After adding it, it runs well.

 

7. analyze the problem

Open c: \ windows \ Microsoft. NET \ framework \ v4.0.30319 \ config \ machine. config and find

<System. Data>
<Dbproviderfactories>
<Remove invariant = "oracle. manageddataaccess. Client"/>
<Add name = "ODP. net, managed driver "invariant =" oracle. manageddataaccess. client "Description =" ORACLE data provider. net, managed driver "type =" oracle. manageddataaccess. client. oracleclientfactory, Oracle. manageddataaccess, version = 4.112.3.60, culture = neutral, publickeytoken = 89b483f429c47342 "/>
</Dbproviderfactories>
</System. Data> the content of this segment already exists.

Open c: \ windows \ Microsoft. NET \ framework64 \ v4.0.30319 \ config \ machine. config again.

 

Change the target platform generated by vs2012 to x86. Everything works normally. an error occurred when changing back to x64. this problem is caused by the program version, and the driver cannot be changed during running.

 

 

 

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.