コード例 #1
0
 public static void Initialize(IServiceProvider serviceProvider)
 {
     using (var context = new RazorPagesContext(
                serviceProvider.GetRequiredService <
                    DbContextOptions <RazorPagesContext> >()))
     {
         SeedProjects(context);
         SeedSpecialization(context);
     }
 }
コード例 #2
0
 public static void SeedSpecialization(RazorPagesContext context)
 {
     if (context.Specialization.Any())
     {
         return;   // DB has been seeded
     }
     //chequeo que el context specialization no sea nulo
     Check.Precondition(context.Specialization != null);
     context.Specialization.AddRange(GetSeedingSpecializations());
     context.SaveChanges();
 }
コード例 #3
0
 public static void SeedProjects(RazorPagesContext context)
 {
     if (context.Project.Any())
     {
         return;   // DB has been seeded
     }
     //como precondición chequeo que el context project no sea nulo
     Check.Precondition(context.Project != null);
     context.Project.AddRange(GetSeedingProjects());
     context.SaveChanges();
 }
コード例 #4
0
 public IndexModel(RazorPagesMovie.Models.RazorPagesContext context)
 {
     _context = context;
 }
コード例 #5
0
 public EditModel(RazorPagesMovie.Models.RazorPagesContext context)
 {
     _context = context;
 }
コード例 #6
0
 public DeleteModel(RazorPagesMovie.Models.RazorPagesContext context)
 {
     _context = context;
 }
コード例 #7
0
 public FinishModel(RazorPagesMovie.Models.RazorPagesContext context)
 {
     _context = context;
 }