This commit is contained in:
2018-12-19 22:22:17 +00:00
parent 6bc95ce92b
commit 5b7c839066
5 changed files with 42 additions and 23 deletions

4
.vscode/launch.json vendored
View File

@@ -31,8 +31,8 @@
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
//"AYANOVA_LOG_LEVEL": "Info",
"AYANOVA_LOG_LEVEL": "Debug",
"AYANOVA_LOG_LEVEL": "Info",
//"AYANOVA_LOG_LEVEL": "Debug",
"AYANOVA_DEFAULT_LANGUAGE": "en",
//LOCALE MUST BE en for Integration TESTING
//"AYANOVA_PERMANENTLY_ERASE_DATABASE": "true",

View File

@@ -83,6 +83,23 @@ TODO SERVER STUFF
- Boot server and seed with debug log turned on,
- see what is being tracked by EF that doesn't need to, seems some of that shit is being tracked.
- Microsoft.EntityFrameworkCore.ChangeTracking|DetectChanges starting
2018-12-19 12:19:44.9942|DEBUG|Microsoft.EntityFrameworkCore.ChangeTracking|'AyContext' generated temporary value '-9223372036854774807' for the 'Id' property of new 'Locale' entity.
2018-12-19 12:19:45.0490|DEBUG|Microsoft.EntityFrameworkCore.ChangeTracking|Context 'Locale' started tracking '{Id: -9223372036854774807}' entity with key 'AyContext'.
...
2018-12-19 12:19:49.2317|DEBUG|Microsoft.EntityFrameworkCore.ChangeTracking|Foreign key property 'LocaleItem.LocaleId' detected as changed from '-9223372036854774807' to '1' for entity with key '{Id: -9223372036854774080}'.
2018-12-19 12:19:49.2317|DEBUG|Microsoft.EntityFrameworkCore.ChangeTracking|Foreign key property 'LocaleItem.LocaleId' detected as changed from '-9223372036854774807' to '1' for entity with key '{Id: -9223372036854774079}'.
2018-12-19 12:19:49.2317|DEBUG|Microsoft.EntityFrameworkCore.ChangeTracking|Foreign key property 'LocaleItem.LocaleId' detected as changed from '-9223372036854774807' to '1' for entity with key '{Id: -9223372036854774078}'.
...
2018-12-19 12:19:52.2781|DEBUG|Microsoft.EntityFrameworkCore.ChangeTracking|The 'LocaleItem' entity with key '{Id: 1129}' tracked by 'AyContext' changed from 'Added' to 'Unchanged'.
2018-12-19 12:19:52.2781|DEBUG|Microsoft.EntityFrameworkCore.ChangeTracking|The 'LocaleItem' entity with key '{Id: 1128}' tracked by 'AyContext' changed from 'Added' to 'Unchanged'.
2018-12-19 12:19:52.2781|DEBUG|Microsoft.EntityFrameworkCore.ChangeTracking|The 'LocaleItem' entity with key '{Id: 1127}' tracked by 'AyContext' changed from 'Added' to 'Unchanged'.
2018-12-19 12:19:52.2781|DEBUG|Microsoft.EntityFrameworkCore.ChangeTracking|The 'LocaleItem' entity with key '{Id: 1126}' tracked by 'AyContext' changed from 'Added' to 'Unchanged'.
...
- See what warnings are displayed about sql usage
- Docs: pagingOptions, sort and filter need to be documented for API

View File

@@ -98,7 +98,7 @@ namespace AyaNova
bool LOG_SENSITIVE_DATA = false;
#if (DEBUG)
LOG_SENSITIVE_DATA = true;
//LOG_SENSITIVE_DATA = true;
#endif

View File

@@ -12,14 +12,6 @@ namespace AyaNova.Biz
//Prime the database with initial, minimum required data to boot and do things (manager account, locales)
public static class PrimeData
{
// private readonly AyContext ct;
// private readonly ILogger<PrimeData> log;
// public PrimeData(AyContext dbcontext, ILogger<PrimeData> logger)
// {
// ct = dbcontext;
// log = logger;
// }
/// <summary>
/// Prime the database with manager account
@@ -49,8 +41,9 @@ namespace AyaNova.Biz
/// Prime the locales
/// This may be called before there are any users on a fresh db boot
/// </summary>
public static void PrimeLocales(AyContext ct)
{
public static void PrimeLocales()
{//
//Read in each stock locale from a text file and then create them in the DB
var ResourceFolderPath = Path.Combine(ServerBootConfig.AYANOVA_CONTENT_ROOT_PATH, "resource");
@@ -60,20 +53,21 @@ namespace AyaNova.Biz
}
ImportLocale(ct, ResourceFolderPath, "en");
ImportLocale(ct, ResourceFolderPath, "es");
ImportLocale(ct, ResourceFolderPath, "fr");
ImportLocale(ct, ResourceFolderPath, "de");
ImportLocale(ResourceFolderPath, "en");
ImportLocale(ResourceFolderPath, "es");
ImportLocale(ResourceFolderPath, "fr");
ImportLocale(ResourceFolderPath, "de");
//Ensure locales are present, not missing any keys and that there is a server default locale that exists
//LocaleBiz lb = new LocaleBiz(ct, AuthorizationRoles.OpsAdminFull);
LocaleBiz lb = LocaleBiz.GetBizInternal(ct, 1, AuthorizationRoles.OpsAdminFull);
LocaleBiz lb = LocaleBiz.GetBizInternal(ServiceProviderProvider.DBContext, 1, AuthorizationRoles.OpsAdminFull);
lb.ValidateLocales();
}
private static void ImportLocale(AyContext ct, string resourceFolderPath, string localeCode)
private static void ImportLocale(string resourceFolderPath, string localeCode)
{
AyContext ct = ServiceProviderProvider.DBContext;
var LocalePath = Path.Combine(resourceFolderPath, $"{localeCode}.json");
if (!File.Exists(LocalePath))
{

View File

@@ -20,7 +20,7 @@ namespace AyaNova.Util
/////////// CHANGE THIS ON NEW SCHEMA UPDATE ////////////////////
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
private const int DESIRED_SCHEMA_LEVEL = 8;
private const int DESIRED_SCHEMA_LEVEL = 9;
internal const long EXPECTED_COLUMN_COUNT = 98;
internal const long EXPECTED_INDEX_COUNT = 22;
@@ -160,7 +160,7 @@ namespace AyaNova.Util
exec("CREATE INDEX alocaleitem_localeid_key_display_idx ON alocaleitem (localeid,key, display)");
//Load the default LOCALES
AyaNova.Biz.PrimeData.PrimeLocales(ct);
AyaNova.Biz.PrimeData.PrimeLocales();
//Add user table
@@ -306,7 +306,7 @@ namespace AyaNova.Util
}
//////////////////////////////////////////////////
//////////////////////////////////////////////////
// TAGS repository
if (currentSchema < 9)
{
@@ -316,6 +316,14 @@ namespace AyaNova.Util
}
//MAKE SURE THE DESIRED SCHEMA WAS SET PROPERLY
if (currentSchema > DESIRED_SCHEMA_LEVEL)
throw new ArgumentOutOfRangeException("AySchema::DesiredSchemaLevel WASN'T SET PROPERLY");
//#########################################
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!