I try to import stored procedures from an Oracle 10g database using an Entity Framework 6 database-first approach but after I import stored procedures from the database and then I open Oracle SQL developer to open the imported stored procedures and I found in just "create or replace " in source code for all stored procedures on the same schema even the ones I didn't import by entity framework in my project why this happens and how to overcome
After I have search I discovered it's better to use ADO.NET with Oracle 10G database and if you want to have entity framwork experience with Oracle database there is one paid third party library called Devart.Data.Oracle.EF6
Related
I'm in the process of converting the existing .Net framework project that uses EF 6 with Database First approach (EDMX) file to .Net Standard 2.1 which connects to SQLDB hosted on Azure.
Existing EDMX file has a constructor (auto generated) that accepts ConnectionString as given below -
public TestDatabaseConnection()
: base(ConfigurationManager.ConnectionStrings["TestDatabaseConnection"].ConnectionString)
{
}
This is breaking for two reasons -
ConfigurationManager.ConnectionStrings works only in .Net framework projects and throw runtime errors in the .Net Core project (for eg- ConfigurationManager.ConnectionStrings returns null).
I need to make changes to the above code to use the AppAuthentication nuget as mentioned in the MSDN docs here
So, what are the options available in order to make this work so that I could use the same nuget package for connecting to the database via EF 6 (database first) for both .net framework and .net core projects?
Is the only available is to convert to Code first and make the necessary changes as mentioned in the above MSDN link?
For reasons beyond my control I have a working MVC5 app with an API using Entity Framework 6 and the Oracle Managed Data Access driver, but I need to switch this to use the unmanaged Oracle driver. I have Oracle Client v12.3 installed. I tried removing the managed Oracle .NET NuGet packages, referenced the unmanaged driver in the project, and changed all of the Oracle.ManagedDataAccess references to Oracle.DataAccess. The Oracle Client install seems okay because I have an older app that works and uses the unmanaged Oracle driver. Both apps are connecting to the same database.
The MVC app compiles and runs however when it attempts to connect to the database I get the following error when it constructs the DbConnection:
The Entity Framework provider type
'Oracle.DataAccess.EntityFramework.EFOracleProviderServices,
Oracle.DataAccess.EntityFramework, Version 4.112.3.0, Culture=neutral,
PublicKeyToken=89b483f429c47342' registered in the application config
file for the ADO.NET provider with invariant name 'Oracle.DataAccess'
could not be loaded. Make sure that the assembly-qualified name is
used and that the assembly is available to the running application.
Does the Oracle unmanaged driver support EF6 and if so what configuration am I missing to allow it to load the driver? Thanks!
EF6 does support Oracle.DataAccess. However, you can't do it via Nuget. Look at the link below for some guidance for someone that's actually resolve it.
Nuget package for Oracle Unmanaged Provider with Entity Framework
Context : I'm creating a web app (in ASP.NET MVC 4) that will offer access to an already existing Oracle database. I'll only need to be able to read data from that DB, no insert, or update, etc. I'm working in Visual Studio Express 2015 for Web.
I've searched a lot for answers to my problems, but to no avail.
My goal is to create models with Entity Framework Database first. I have added Entity Framework, Oracle.ManagedDataAccess, and Oracle.ManagedDataAccess.EntityFramework to my project with NuGet.
However, when I try to add an "ADO.NET Entity Data Model" to my Models, whether I select "EF Designer from database" or "Code First from database", I get the following:
What am I missing ?
I've found resources saying I need to install Oracle Developer Tools for Visual Studio. However, it is not supported in Visual Studio Express, and I cannot change my IDE.
I don't have Oracle client installed on this dev computer, but I sqldeveloper, and have no issue accessing the database with it. Do I NEED to install the Oracle client ? Aren't the dll installed throught NuGet enough ? I'm asking because I'm an intern, and installing any new piece of software requires validation, that takes quite a long time.
add connection your database to your project
Insert New Item an Empty Dataset
In that dataset insert TableAdapter from toolbox into your dataset.
window pops up for selecting tables (you can write sql for select a desired table)
after step 4. you have your entity.
I have the same bug and I fix like this:
You need instal:
Microsoft Visual Studio 2015 or later with .NET Framework 4.5 or later.
Oracle Database 12c or later.
Oracle Data Access Components (ODAC) 12c Release 3 (12.1.0.2.1) or later from OTN. The ODAC download includes Oracle Developer Tools for Visual Studio and ODP.NET
Files required for this tutorial.
Using NuGet to Install and Configure Oracle Data Provider for .NET tutorial.(install: Oracle.ManagedDataAccess.EntityFramework from Nuget).
refer: http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/2015/entityframework_linq_modelfirst/Entity%20Framework%20LINQ%20and%20Model%20First.html#overview
I am trying to do Code-First development with EF 5.0 and Oracle Data Client 11.2.0. I have been reading online that 12c version of Oracle Client supports Code first but I am wondering if 11.2.0 supports it as well. I got my code to work Database-First approach but for the Code-First approach its asking me to set Sql Generator which I cannot find within Oracle Client 11.2.0. Am I doing something wrong or does oracle client 11.2.0 not support Code-First Approach?
I am using EF 4.x POCO Entity Generator for C# for generating classes from database. I have put some data annotation on some classes and its working fine.
But when i made any change in the database and update the entity model, it removes all the changes in the poco classes (data annotations) because "EF 4.x POCO Entity Generator for C#" is persistence ignorant.
But i want to keep my changes. What should i do?
Very common problem. What you want is Buddy Classes.
http://hartzer.wordpress.com/2010/01/26/mvc-buddy-class/
Since POCO's are partial classes, you can create "buddy classes" (that persist outside of the EDMX ad regenerated code) for each POCO with Meta Data Annotations.
Your solution is to generate your code from the database using the entity framework power tools.
Additional db changes should be done to your code first and the use the database migrations feature of entity framework to generate your SQL script to apply to the database using the update-database command in the 'Package Manager Console' of Visual Studio
I go over a similar procedure here at the end on my DEV215 Entity Framewok for Real Web Applications Channel 9 video
http://channel9.msdn.com/Events/TechEd/NorthAmerica/2012/DEV215