This commit is contained in:
2018-10-08 20:07:38 +00:00
parent d58ede8fd3
commit 7df84c1ce8
9 changed files with 275 additions and 14 deletions

View File

@@ -404,13 +404,27 @@ namespace AyaNova
//TESTING
if (TESTING_REFRESH_DB)
{
AyaNova.Core.License.Fetch(apiServerState, dbContext, _log);
Util.Seeder.SeedDatabase(Util.Seeder.SeedLevel.HugeForLoadTest);
AyaNova.Core.License.Fetch(apiServerState, dbContext, _log);
Util.Seeder.SeedDatabase(Util.Seeder.SeedLevel.SmallOneManShopTrialDataSet);
}
//TESTING
#endif
//TEST AUTOID
//Note that seeder may init this already in which case this code doesn't even need to run
if (ServerBootConfig.WIDGET_SERIAL == null)
{
//query for most recently used serial number
//(note, can't query for highest serial as it can and likely will reset or be changed manually from time to time
// so the algorithm is to keep the most recent sequence going on startup of the server)
var MostRecentWidget = dbContext.Widget.AsNoTracking().OrderByDescending(x => x.Id).FirstOrDefault();
uint MaxWidgetId = 0;
if (MostRecentWidget != null)
MaxWidgetId = MostRecentWidget.Serial;
ServerBootConfig.WIDGET_SERIAL = new AutoId(MaxWidgetId);
}
//Open up the server for visitors
apiServerState.SetOpen();