示例#1
0
文件: dbInit.cs 项目: fong/3t-api
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new t3Context(
                       serviceProvider.GetRequiredService <DbContextOptions <t3Context> >()))
            {
                if (context.Game.Count() > 0)
                {
                    context.Game.RemoveRange(context.Game);
                    context.SaveChanges();
                }

                //if (context.Player.Count() == 0)
                //{
                //    context.Player.AddRange(new Player
                //    {
                //        playerID = "aaaaaa",
                //        playerName = "SundriedTofu",
                //        mmr = 0,
                //        wins = 0,
                //        games = 0
                //    });
                //    context.SaveChanges();
                //}

                //if (context.Auth.Count() == 0)
                //{
                //    context.Auth.AddRange(new Auth
                //    {
                //        playerID = "aaaaaa",
                //        playerName = "SundriedTofu",
                //        passcode = "376989"
                //    });
                //    context.SaveChanges();
                //}
                return;
            }
        }
示例#2
0
 public GamesController(t3Context context)
 {
     _context = context;
 }
示例#3
0
 public PlayersController(t3Context context)
 {
     _context = context;
 }
示例#4
0
 public AuthsController(t3Context context)
 {
     _context = context;
 }