private static void DbInit(IApplicationBuilder app)
 {
     using (var serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope())
     {
         using (var context = serviceScope.ServiceProvider.GetRequiredService <PlatformDbContext>())
         {
             context.Database.EnsureCreated();
             var flags = context.Set <Hcs.Platform.BaseModels.PlatformFlag>();
             if (!flags.Any(x => x.Flag == "SeedData" && x.Value == "true"))
             {
                 flags.Add(new Hcs.Platform.BaseModels.PlatformFlag {
                     Flag = "SeedData", Value = "true"
                 });
                 context.SaveChanges();
                 DbContextBuilder.RunSeeds(context);
             }
             foreach (var u in context.Set <Hcs.Platform.BaseModels.PlatformUser>())
             {
                 UserDataChangeTime.Update(u.Id, u.LastUpdatedTime ?? DateTime.MinValue);
             }
         }
     }
 }