示例#1
0
        //private readonly XGamesContext context;
        public static void Initialize(IServiceProvider ServiceProvider)
        {
            using (var context = new XGamesContext(
                       ServiceProvider.GetRequiredService <
                           DbContextOptions <XGamesContext> >())) {
                // Look for any movies.
                if (context.Game.AnyAsync <Game>().Result)
                {
                    return;   // DB has been seeded
                }

                context.AddRange(
                    new Game()
                {
                    Genre = "Action", Price = 10.34M, Title = "Eragon", ReleaseDate = DateTime.Now.AddYears(-5), Rating = "R"
                },
                    new Game()
                {
                    Genre = "Shooter", Price = 4.34m, Title = "Fortnite", ReleaseDate = DateTime.Now.AddYears(-5), Rating = "R"
                },
                    new Game()
                {
                    Genre = "Third Person", Price = 4.90M, Title = "GTA 5", ReleaseDate = DateTime.Now.AddYears(-5), Rating = "R"
                },
                    new Game()
                {
                    Genre = "Action", Price = 6.34M, Title = "Eragon", ReleaseDate = DateTime.Now.AddYears(-5), Rating = "R"
                }

                    );
                context.SaveChanges();
            }
        }
 public CartRepository([FromServices] XGamesContext context) : base(context)
 {
 }
示例#3
0
 public PlayerRepository(XGamesContext context) : base(context)
 {
     _context = context;
 }
示例#4
0
 public UnitOfWork(XGamesContext context)
 {
     _context = context;
 }
示例#5
0
 public BaseRepository(XGamesContext context)
 {
     _context = context;
 }
 public GamePictureRepository([FromServices] XGamesContext context) : base(context)
 {
 }
示例#7
0
 public LineItemRepository([FromServices] XGamesContext context) : base(context)
 {
 }
示例#8
0
 public GameRepository(XGamesContext context) : base(context)
 {
     _context = context;
 }