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;
}