Postgres data does not exist error

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
dgxhubbard
Posts: 47
Joined: Fri 14 Aug 2015 20:58

Postgres data does not exist error

Post by dgxhubbard » Sun 01 Jul 2018 21:58

We are using postgres dotconnect on Ef Core 2.1 with the pseudo code below to create a database. We get the error the database "Boo" does not exist. What do we need to do to get this working?

Code: Select all

		var connectionString = "User Id=postgres;Password=Foo;Host=MyMachine;Database=Boo;License Key=""";
                try
                {
                    using ( var context = new MyContext ( connectionString ) )
                    {
                        context.Database.EnsureCreated ();

                        context.SaveChanges ();
                    }
                }
                catch ( Exception ex )
                {
                    LogProvider.Logger.LogException ( "Failed to create empty database", ex );
                    throw ex;
                }


Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Postgres data does not exist error

Post by Shalex » Mon 02 Jul 2018 08:11

Please turn on the following option and try again:

Code: Select all

            var config = Devart.Data.PostgreSql.Entity.Configuration.PgSqlEntityProviderConfig;
            config.DatabaseScript.Schema.DeleteDatabaseBehaviour = Devart.Data.PostgreSql.Entity.Configuration.DeleteDatabaseBehaviour.Database;
For more information, refer to https://www.devart.com/dotconnect/postg ... ation.html.

Post Reply