Exemplo n.º 1
0
        public HighScore SelectedPlayer(string playerName)
        {
            using IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.ConnString("CardGame"));
            var currentPlayer = connection.QueryFirst <HighScore>($"select H.player, H.Score from HighScore as H where H.player = '{playerName}'");

            return(currentPlayer);

            //return connection.QueryFirst<HighScore>($"select H.player from HighScore as H where H.Id = {id}");
            //return connection.Query<HighScore>($"select H.player from HighScore as H where H.Id = {id}");
        }
Exemplo n.º 2
0
        public WarmUp()
        {
            Console.WriteLine("开启预热");
            //预热处理
            for (int i = 0; i < 2; i++)
            {
                using (SqlConnection conn = new SqlConnection(PubConst.connectionString))
                {
                    var list = conn.QueryFirst<Test>("select top 1 * from Test");
                    conn.Update(new Test());
                }

                using (SqlSugarClient conn = new SqlSugarClient(PubConst.connectionString))
                {
                    var list = conn.Queryable<Test>().Where(it => 1 == 2).ToList();
                    conn.Update(new Test());
                }
            }
            Console.WriteLine("预热完毕");
            Console.WriteLine("----------------比赛开始-------------------");
        }
Exemplo n.º 3
0
 public HighScore GetSingleHighScore()
 {
     using IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.ConnString("CardGame"));
     return(connection.QueryFirst <HighScore>("select * from HighScore"));
 }