I have the PostgreSQL database on remote server. And when i'm trying to update entity model in my web-project from database in visual studio i get such error:
Unable to convert connection string for execution time to its
equivalent for development time.
There is my connectionstring:
metadata=res://*/Model.MerModel.csdl|res://*/Model.MerModel.ssdl|res://*/Model.MerModel.msl;provider=Npgsql;provider connection string="PORT=5432;TIMEOUT=15;POOLING=True;MINPOOLSIZE=1;MAXPOOLSIZE=20;COMMANDTIMEOUT=20;COMPATIBLE=2.2.5.0;DATABASE=****;HOST=***.***.*.**;PASSWORD=********;USER ID=postgres""
Connection parameters are correct. Using them I can connect to a database in PostgreSQL Client. Help me, please. What is the problem?
UPD: Finally i found solution for my problem. I deleted Npgsql and Npgsql.EntityFramework packages from the project (to make clean installation of new versions). Then i installed Npgsql v.3.2.7 and EntityFramework6.Npgsql v.3.1.1. After this i deleted "COMPATIBLE=2.2.5.0" from my connectionstring. Then it was necessary to rebuild all the project. Note that Npgsql PostgreSQL Integration VSIX must be installed in your Visual Studio. Finally i can update my EF model from the database and check if it is correct after this manipulations.
Related
I've seen a lot of posts about this, but none of the solutions are working for me.
I'm using Visual Studio 2019, on a Windows machine.
I have Oracle instantclient_21_3, ora12c, and ora12c64 all installed on my computer.
I have EntityFramework, ODAC.x86.11g, odp.net.x64, Oracle.ManagedDataAccess, and
Oracle.ManagedDataAccess.EntityFramework, all installed through VS NuGet Package Manager.
I have Entity Framework 6 tools installed in Visual Studio.
I've created a new Console App (.NET Framework) project, and I have also successfully connected to external Oracle databases from the server explorer in VS. I am trying to add ADO.NET Entity Data Model to my project (selecting 'EF Designer from database'). The only 'data source' options are 'Microsoft SQL Server' and 'Microsoft SQL Server Database File', and ''. Since it's an Oracle database, I select '', and I'm having issues connecting to the server. I'm assuming it's because it's an Oracle database instead of SQL, but I do not know how to resolve this. Pls help
I want to get the sql of some migrations that were already executed on my developer machine, so I can execute them on some other enviroment(qa, prod, ...).
I found this page http://msdn.microsoft.com/en-us/data/jj591621.aspx (section Getting a SQL Script), but this works only if you have pending migrations. I tried:
Update-Database -Script -SourceMigration: $InitialDatabase -TargetMigration: SomeMigration
but got Target database is already at version SomeMigration.
Can I get the sql of already executed migration?
EF6, MVC5, VisualStudio 2013
Well, it does exactly what it should since you invoke Update-Database on your local environment.
If you need to generate update script for another environment I see the following options:
You can target your local application to the database from remote environment. In this case it is enough to change connection string in your web.config manually.
You can revert your local database to the state of the database that your remote environment is targeting.
Update-Database –TargetMigration: "last migration on remote environment"
I've just installed visual studio 2013 and tried to setup Entity framework to access an oracle database.
I click on new ADO.NET entity model, then Generate from database, but on the data connection screen when I click "New Connection" I don't get oracle appearing the list of datasources. I only get two SQL server options.
Do I need to install something extra to get this to work?
The Oracle data source appears in my 2012 version of visual studio that I've got installed on the same machine, so not sure why it doesn't work in 2013.
it has not been released yet
https://forums.oracle.com/message/11239147#11239147
Regards.
You are using Entity Framework 6 and in its first release it only has a provider for SqlServer stuff, there is a support from external tools (DevArt) have a look at this page:
Entity Framework 6 Free Oracle Data Provider
As of Version 12.1 Release 2 Visual Studio 2013 is supported:
http://www.oracle.com/technetwork/database/windows/newfeatures-084113.html
The Oracle provider is not yet currently built against EF6 so if you are planning on using Entity Framework in MVC5, you need to install EF5 by running "Install-Package EntityFramework -Version 5.0.0" on the Package Manager Console.
If you are starting a bootstrapped MVC5 WebApp don't use the Individual User Account membership provider as it relies on EF6. You can go for one of the many alternate membership providers (http://nugetmusthaves.com/Tag/membership)
Yes. It is way more complicated that you would expect.
Go here: http://www.oracle.com/technetwork/topics/dotnet/downloads/index.html and download the appropriate installation file. (You have to create an Oracle account. You can choose a specific version of Visual Studio, or the 300+ MB download will handle multiple versions.)
Extract the zip file and run setup.exe. (I kept all the defaults.)
Click the Install button. (Close Visual Studio, by the way) After several minutes, it will finish installing.
Open Visual Studio, create new ADO.NET entity model, Generate from database, New Connection. This time hopefully you will as your Data Source: Oracle Database (ODP.NET, Managed Driver).
I'm was told recently that in our current project we have to use Oracle instead of SQL Server.
I need some help to make it work. I've already installed Visual Studio ODTwithODAC but when I try to run the command update-database in the Package Manager Console, the following error is thrown:
A null was returned after calling the 'get_ProviderFactory' method on a store provider instance of type 'System.Data.OracleClient.OracleConnection'. The store provider might not be functioning correctly.
I know that the problem is not the access to DB because I could connect to it via Server Explorer and I took the connection string from it.
My connection string goes like this:
<add name="LpssContext"
connectionString="SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.0.1.106)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)));uid=sys;pwd=sys;"
providerName="System.Data.OracleClient" />
Any ideas about what's wrong?
Does Oracle support code-first migrations?
Currently there's no support for CFM with Oracle connector.
There's a paid connector that support it though, http://blog.devart.com/entity-framework-code-first-migrations-support-for-oracle-mysql-postgresql-and-sqlite.html
The other option is to change your db layer to DB First (with lots of work) manually, as I finally did
While developing an application I used EF automatic migrations. So now when I have deployed my app on VPS, I don't know how to add new tables and fields to my database.
Can I connect to the remote database directly from my project in VS2012, updating a connection string, and update the database using "update-database" in package manager console? Or do I need to install VS on my VPS and update the database from VPS?
My database is already filled with data, so I can't delete it and create again.
Yes you can use Visual Studio, follow this tutorial - it should work for VS 2012 too.
You can also use Code first Migration to update your model by using this command in package manager console:
Update-Database
and you can specify your connection string name:
Update-Database -ConnectionStringName "MyConnectionString"
This is best explained in the link below. Read the "Getting a SQL script" section. That will explain how to generate a script which you can then run on your target database.
This will be necessary if your database access is IP protected for example.
https://msdn.microsoft.com/en-us/data/jj591621.aspx