示例#1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new WebChessContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <WebChessContext> >()))
            {
                if (context.ChessGame.Any())
                {
                    return;   // DB has been seeded
                }

                context.ChessGame.AddRange(

                    new ChessGame
                {
                    playerWhite = "Test",
                    playerBlack = "Test2",
                    gameType    = "blitz",
                    pgn         = "dfasffffffa",
                    fens        = "dfasfa,sasa",
                    winner      = "das43444da"
                }



                    );
                context.SaveChanges();
            }
        }
示例#2
0
 public ProfileModel(WebChessContext context, UserManager <WebChessUser> userManager)
 {
     _context     = context;
     _userManager = userManager;
 }