mirror of
https://github.com/oqtane/oqtane.framework.git
synced 2025-05-18 10:34:22 +00:00
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
|
||||
var type = Type.GetType(databaseType);
|
||||
|
||||
// create database object from type
|
||||
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))
|
||||
if (type != null)
|
||||
{
|
||||
// create empty database if it does not exist
|
||||
dbc.Database.EnsureCreated();
|
||||
result.Success = true;
|
||||
// create database object from type
|
||||
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
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user