Tests.DapperReadmeVsChain.Example2_Chain C# (CSharp) Method

Example2_Chain() private method

private Example2_Chain ( ) : void
return void
        public void Example2_Chain()
        {
            //DataTable - When you want to bind to WinForms or WPF data grids.
            DataTable dt = s_DataSource.Sql("select 1 A, 2 B union all select 3, 4").ToDataTable().Execute();

            //Table - When you want a lightweight alternative to DataTable
            Table table = s_DataSource.Sql("select 1 A, 2 B union all select 3, 4").ToTable().Execute();

            //Dynamic Objects - When you want the convience of dynamic typing
            List<dynamic> rows = s_DataSource.Sql("select 1 A, 2 B union all select 3, 4").ToDynamicCollection().Execute();

            Assert.AreEqual(1, rows[0].A);
            Assert.AreEqual(2, rows[0].B);
            Assert.AreEqual(3, rows[1].A);
            Assert.AreEqual(4, rows[1].B);
        }