예제 #1
0
파일: Program.cs 프로젝트: manepal/Sqorm
        private static void TestDbConnection(IDatabaseConnection connection)
        {
            connection.Open();
            connection.SetCommandType(SqormCommandType.Text);
            string query = "SELECT * FROM users WHERE id >= @id;";
            var users = connection.ExecuteReader<User>(query, new ParameterContainer {{ "@id", 1 }});
            query = "SELECT * FROM users WHERE id=@id;";
            connection.SetCommandType(SqormCommandType.StoredProcedure);
            connection.Close();

            foreach (var user in users)
            {
                System.Console.WriteLine(user.ToString());
            }
        }