public static void Initialize(IServiceProvider serviceProvider)
        {
            m_ServiceProvider = serviceProvider;

            using (var context = new RacingLeagueManagerContext(
                       serviceProvider.GetRequiredService <DbContextOptions <RacingLeagueManagerContext> >()))
            {
                // look for any tracks
                if (context.Track.Any())
                {
                    return; // db has been seeded
                }

                context.Track.AddRange(
                    new Track
                {
                    Name = "Catalyuna GP"
                },
                    new Track
                {
                    Name = "Catalyuna Short"
                },
                    new Track
                {
                    Name = "Sonoma Full"
                }
                    );

                context.SaveChanges();
            }

            GenerateDGML();
        }
 public CreateModel(RacingLeagueManager.Data.RacingLeagueManagerContext context)
 {
     _context = context;
 }
Exemple #3
0
 public IndexModel(RacingLeagueManager.Data.RacingLeagueManagerContext context)
 {
     _context = context;
 }
 public DetailsModel(RacingLeagueManager.Data.RacingLeagueManagerContext context)
 {
     _context = context;
 }