Trying to use Entity Framework with Oracle DB - c#

Hi I am trying to use Entity-Framework in asp.net MVC , for that I have installed Oracle.Managed.DataAccess version 19.6.0 and Oracle.Managed.DataAccess.EntityFramework version 19.6.0
and oracle version 11.2.0 I am able to connect Oracle DB in server explorer but while adding new item in solution not getting any option to connect Oracle DB what is the issue I am not able to identify ,Any idea would be appreciated.
Image

Those are just the Nuget packages to allow your project to connect to Oracle.
I believe you need to add Oracle Developer Tools for Visual Studio to have the options available in the Visual Studio dialogs.
https://www.oracle.com/database/technologies/developer-tools/visual-studio/

You need to install a Oracle Client and TNSNAMES.ORA
The installation has a component list, if you insall that components (like Oracle developer Tools for visualStudio) it you can add your EF. and then when you finish you only need to add your TNSNAMES in order to create the Entities in VS.

Related

Visual Studio ADO .NET can't connect to mysql database

I work on Windows Forms project in C# and I need to connect to mysql database (localhost:3306).
I use Entity framework 6.4.0 and .NET Connector 8.0.18.
When I go to Project -> Add New Item -> Data -> ADO .NET Entity Model and go to Code First from database -> New Connection , my Choose Data Source Dialog haven't option for MYSQL DATABASE
I have Mysql Workbench 8.0 and I connected to database.
When I click on other option I have dialog:
Can't find database to select.
Where is the problem?
For that case, it normally happens when you install visual studio after installation of MySQL. Try re-installing MYSQL then it will have to work.
Note: Ensure backing up all your databases first
Happy programming.

Connecting to MySQL in VS2017 in ASP.NET MVC 5 project

I'm new to ASP.NET and MVC, trying to move from WinForms. I'm using Visual Studio 2017 Pro, and I am trying to follow some tutorials for connecting to an existing MySQL database. I plan to use the Database First method as the database already exists. I have the following config :-
Windows 10 Pro 64 bit on my PC
VS 2017 Pro
MySQL for Visual Studio 2.0.5
MySQL Connector 6.10.4
EntityFramework v6.2.0
Mysql.Data 6.10.4
Mysql.Data.Entity 6.10.4
Mysql.Web 6.10.4
I can make a database connection using the Server Explorer, but when I'm using the EDM wizard to create the model from the database, the connection isn't showing in the drop-down box, and if I try to create a new one, the MySQL driver doesn't show as an available option, only SQL Server.
I've tried various combinations of MySQL for VS, MySQL Connector, EF and MySQl components (older versions) but I can't seem to find a winning combination.
Has anyone managed to achieve this ? I'm pulling out what's left of my hair. Thanks.
enter image description here
OK I finally found an answer, I now have EF 6.1.3 and MySQL Connector 6.9.9 installed.
I needed to change the part of the Web.Config file as described by James Wilkins in this post.
Thanks to Panagiotis for your help.

How to add Oracle provider in VS2017 for Entity Framework?

I want to connect to a database(Oracle 12c) for generating ADO.NET model, Code First From Database. I have installed ODAC for VS but there is still no option for connecting Oracle DB at the Entity Data Model Wizard:
At Server Explorer there is a Oracle provider but it is stated as deprecated:
I've also tried to install the following 4 Nuget packages but still no Oracle provider at Entity Data Model Wizard:
I'm suspecting VS2017(Community) is not looking at where I installed ODAC for the list of providers it use but I can't figure where it store this configuration.
Is there anything I'm missing? Or is there other ways to use EF for Oracle? E.g. Fallback to VS2015, create entity models manually (how do I do that?), etc.
Please help me I don't want to write plain SQL in code ever again! Thanks.
I have the same error. I solve this problem by add Oracle database from Visual 2015. And then Open project by Visual 2017. It done. I has been read a lot of topic about this. They say now, Oracle not yet Support for connecting Oracle DB at the Entity Data Model Wizard you can see at here:
https://community.oracle.com/thread/4024914
There is something extra:
Nuget package manager suggests Oracle.ManagedDataAccess.EntityFramework 18.3.0
This won't work with the latest ODP.
Nuget Package versions should match ODP versions:
ODP 12.2.0.1.1
Nuget Oracle.ManagedDataAccess.EntityFramework 12.2.1100
If not the Entity Data Model Wizard will crash without leaving any trace in the
C:\Users\YOURUSER\AppData\Roaming\Microsoft\VisualStudio
I solved this by installing Oracle Developer Tools for Visual Studio 2017
I hade the sam problem, but found the solution here:
Do not use the .NET driver. Use the ODP.NET driver (managed or unmanaged).
http://www.oracle.com/technetwork/topics/dotnet/whatsnew/vs2012welcome-1835382.html
Create a new connection from Server Explorer in Visual Studio and use these images as guides: change the datasource, making sure to choose the flavor of ODP.NET that your .NET application will use (Managed or Unmanaged) - and then connect to oracle. In the Oracle connection dialog, if you have a connection alias choose a "Connection Type" of "TNS" and then choose the alias from the "Data Source Name" drop down list. If you do not have a connection alias, you can choose a Connection Type of "EZ Connect" and then provide the host, port, and service name for the database you wish to connect to.
Best Regards, Par
I was facing same problem. first ensure that you installed odac for visual studio 2017
just go this link and follow:
https://www.oracle.com/technetwork/topics/dotnet/downloads/odacmsidownloadvs2017-3806459.html
uninstall previous odac version.
Hopefully, if you install from the link, you will get all things.

Can't install ADO.NET provider for sqlite in VS2013

after reading this article missing SQLite data provider in VS 2013 , I've tried to register SQLITE provider for VS 2013 installing the specific provider with ddex included but with no result.
When I reboot VS 2013 I can't find it in the list of ADO.NET provider and I can't create the Model for my sqlite DB.
Managing app.config of my application I was able to load dinamically the provider but this is not a good choice for my developer's team.
I've also tried to install SQL Server Compact & SQLite Toolbox for VS but now I can see only SQLCE provider and not Sqlite.
Searching DATAPROVIDER in windows registry i've seen that the Sqlite provider and SQLCE provider were installed in two different ways, infact under supported object for SQLCE data provider I can find many reference to Visual Studio(ex: IVsDataAsyncCommand) , while under Supported object of SQLite provider I can see any reference to Visual studio.
In my opinion the problem is here.
Is there a simple way to register DDEX SQLite provider on VS 2013 in windows registry or any other type of operation to do to register this provider definitively?
Thanks in advance,
Fabio
you go to the page of System.Data.SQLite download page.
You have to download and install the correct BUNDLE package, depends on your framework and VS version.
Assuming framework 4.5.1 you have to download
sqlite-netFx451-setup-bundle-x86-2013-1.0.94.0.exe
This is the only setup package that is capable of installing the design-time components for Visual Studio 2013.

Access Oracle database from Visual Studio 2008

I need to be able to access Oracle database from Visual Studio 2008(Framework 3.0/3.5). The Database version is 11g.
But I also may need to access older version of this database going back to the year 2007.
I tired to install Oracle database client 11gR2 on my desktop computer which has Windows 7 Enterprise edition.
It did not run from Setup menu but ran from background it seems.
Did notice a folder in C:/Oracle with 2 files sqlnet.ora and TnsNames.ora, but apart from that I noticed in the c:\windows\assembly there was no Oracle.DataAccess components installed.
Which client or tools should I need to install to be able to access versions of Oracle from Visual Studio 2008?
Assuming you suggest there is a client version for each of the Database versions, Can I install one client version on top of the other.
Now that I have installed the client 11gR2 can you tell me if I need to install it, I do not see an uninstaller under my "All Programs" menu .
First of all you need to install ODAC as mentioned in the comment.
Then in your project you need to reference Oracle.DataAccess and in your code you need to include the following
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;

Categories