コード例 #1
0
ファイル: HoodDbContext.cs プロジェクト: HoodDigital/Hood
        public bool AllMigrationsApplied()
        {
            System.Collections.Generic.IEnumerable <string> applied = this.GetService <IHistoryRepository>()
                                                                      .GetAppliedMigrations()
                                                                      .Select(m => m.MigrationId);

            System.Collections.Generic.IEnumerable <string> total = this.GetService <IMigrationsAssembly>()
                                                                    .Migrations
                                                                    .Select(m => m.Key);

            return(!total.Except(applied).Any());
        }
コード例 #2
0
 /// <summary>
 /// Checks that the given sets contain the same items. Order does not matter.
 /// </summary>
 /// <typeparam name="T">The type of both sets' items.</typeparam>
 /// <param name="set1">First set.</param>
 /// <param name="set2">Second set.</param>
 /// <returns>Whether or not the sets are equivalent.</returns>
 public static bool SetsAreEquivalent <T>(System.Collections.Generic.IEnumerable <T> set1, System.Collections.Generic.IEnumerable <T> set2)
 {
     return(set1.Count() == set2.Count() && !set1.Except(set2).Any());
 }