コード例 #1
0
 public static void Seed(this DemofContext context, IWebHost host)
 {
     if (context.AllMigrationsApplied())
     {
         var seed = new Seeder(host, context);
         seed.Seed(host);
     }
 }
コード例 #2
0
        public static bool AllMigrationsApplied(this DemofContext 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());
        }
コード例 #3
0
 public UserRepository(DemofContext context) : base(context)
 {
 }
コード例 #4
0
 public GenericRepository(DemofContext context)
 {
     _context = context;
 }
コード例 #5
0
 public Seeder(IWebHost host, DemofContext context)
 {
     this.context = context;
 }