Fix #3604 - display message if user is attempting to run the application prior to performing a full compilation
This commit is contained in:
parent
f75179b2f6
commit
3dc28c7291
@ -216,19 +216,27 @@ namespace Oqtane.Infrastructure
|
|||||||
// get database type
|
// get database type
|
||||||
var type = Type.GetType(databaseType);
|
var type = Type.GetType(databaseType);
|
||||||
|
|
||||||
// create database object from type
|
if (type != null)
|
||||||
var database = Activator.CreateInstance(type) as IDatabase;
|
|
||||||
|
|
||||||
// create data directory if does not exist
|
|
||||||
var dataDirectory = AppDomain.CurrentDomain.GetData(Constants.DataDirectory)?.ToString();
|
|
||||||
if (!Directory.Exists(dataDirectory)) Directory.CreateDirectory(dataDirectory ?? String.Empty);
|
|
||||||
|
|
||||||
var dbOptions = new DbContextOptionsBuilder().UseOqtaneDatabase(database, NormalizeConnectionString(install.ConnectionString)).Options;
|
|
||||||
using (var dbc = new DbContext(dbOptions))
|
|
||||||
{
|
{
|
||||||
// create empty database if it does not exist
|
// create database object from type
|
||||||
dbc.Database.EnsureCreated();
|
var database = Activator.CreateInstance(type) as IDatabase;
|
||||||
result.Success = true;
|
|
||||||
|
// create data directory if does not exist
|
||||||
|
var dataDirectory = AppDomain.CurrentDomain.GetData(Constants.DataDirectory)?.ToString();
|
||||||
|
if (!Directory.Exists(dataDirectory)) Directory.CreateDirectory(dataDirectory ?? String.Empty);
|
||||||
|
|
||||||
|
var dbOptions = new DbContextOptionsBuilder().UseOqtaneDatabase(database, NormalizeConnectionString(install.ConnectionString)).Options;
|
||||||
|
using (var dbc = new DbContext(dbOptions))
|
||||||
|
{
|
||||||
|
// create empty database if it does not exist
|
||||||
|
dbc.Database.EnsureCreated();
|
||||||
|
result.Success = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.Message = $"The Database Provider {databaseType} Does Not Exist. If This Is A Development Environment Please Ensure You Have Performed A Full Compilation Of All Projects In The Oqtane Solution Prior To Running The Application.";
|
||||||
|
_filelogger.LogError(Utilities.LogMessage(this, result.Message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user