示例#1
0
        public static bool AllMigrationsApplied(this SocialNetworkAnalyserContext context)
        {
            var applied = context.GetService <IHistoryRepository>()
                          .GetAppliedMigrations()
                          .Select(m => m.MigrationId);

            var total = context.GetService <IMigrationsAssembly>()
                        .Migrations
                        .Select(m => m.Key);

            return(total.Except(applied).Any());
        }
示例#2
0
 public static void EnsureMigrated(this SocialNetworkAnalyserContext context)
 {
     context.Database.Migrate();
 }