This commit is contained in:
2018-09-27 19:38:50 +00:00
parent 03b21d29b4
commit 3528d3f69c
4 changed files with 65 additions and 17 deletions

View File

@@ -165,13 +165,21 @@ namespace AyaNova.Util
//PERF
watch.Stop();
log.LogInformation($"** (SYNC) Users seeded in {watch.ElapsedMilliseconds} ms");
log.LogInformation($"Users seeded in {watch.ElapsedMilliseconds} ms");
//20000 widgets
for (int i = 0; i < 400; i++)
{
GenSeedWidget(log, 50);
}
log.LogInformation($"Seeding Widgets....");
watch = new Stopwatch();
watch.Start();
GenSeedWidget(log, 20000);
// for (int i = 0; i < 400; i++)
// {
// GenSeedWidget(log, 50);
// }
//PERF
watch.Stop();
log.LogInformation($"Widgets seeded in {watch.ElapsedMilliseconds} ms");
break;
}
@@ -306,9 +314,13 @@ namespace AyaNova.Util
u.UserOptions = new UserOptions(1);
u.UserOptions.EmailAddress = p.Email.Replace("gmail.com", "helloayanova.com").Replace("hotmail.com", "helloayanova.com").Replace("yahoo.com", "helloayanova.com");
//var NewObject = Biz.CreateAsync(u).Result;
var NewObject = Biz.Create(u);//sync version seems consistently faster than async one
//Re-instantiating the biz object in the loop speeds it up probably due to db context losing changes to track from before
// UserBiz Biz = UserBiz.GetBizInternal(ServiceProviderProvider.DBContext);
// //allow creation of not entirely ready users (missing client id or subcontractor vendor id etc)
// Biz.SeedOrImportRelaxedRulesMode = true;
var NewObject = Biz.Create(ServiceProviderProvider.DBContext, u);//sync version faster than async one
if (NewObject == null)
{
log.LogError($"Seeder::GenSeedUser error creating user {u.Name}\r\n" + Biz.GetErrorsAsString());
@@ -343,7 +355,7 @@ namespace AyaNova.Util
//this is nonsense but just to test an enum
o.Roles = AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited;
o.Notes = f.Lorem.Paragraph();
var NewObject = Biz.CreateAsync(o).Result;
var NewObject = Biz.Create(ServiceProviderProvider.DBContext, o);
if (NewObject == null)
{
log.LogError($"Seeder::GenSeedWidget error creating widget {o.Name}\r\n" + Biz.GetErrorsAsString());