public void CanCopyTableWithTransform()
        {
            using(UsersToPeople process = new UsersToPeople())
                process.Execute();

            System.Collections.Generic.List<string[]> names = Use.Transaction<System.Collections.Generic.List<string[]>>("test", delegate(IDbCommand cmd)
            {
                System.Collections.Generic.List<string[]> tuples = new System.Collections.Generic.List<string[]>();
                cmd.CommandText = "SELECT firstname, lastname from people order by userid";
                using (IDataReader reader = cmd.ExecuteReader())
                {
                    while(reader.Read())
                    {
                        tuples.Add(new string[] { reader.GetString(0), reader.GetString(1) });
                    }
                }
                return tuples;
            });
            AssertNames(names);
        }
        public void CanCopyTableWithTransform()
        {
            using (UsersToPeople process = new UsersToPeople())
                process.Execute();

            System.Collections.Generic.List <string[]> names = Use.Transaction <System.Collections.Generic.List <string[]> >("test", delegate(IDbCommand cmd)
            {
                System.Collections.Generic.List <string[]> tuples = new System.Collections.Generic.List <string[]>();
                cmd.CommandText = "SELECT firstname, lastname from people order by userid";
                using (IDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tuples.Add(new string[] { reader.GetString(0), reader.GetString(1) });
                    }
                }
                return(tuples);
            });
            AssertNames(names);
        }
Ejemplo n.º 3
0
        public void CanCopyTableWithTransformFromConnectionStringSettings()
        {
            using (var process = new UsersToPeople(TestDatabase.ConnectionString))
            {
                process.Execute();
            }

            List <string[]> names = Use.Transaction(TestDatabase.ConnectionStringName, cmd =>
            {
                List <string[]> tuples = new List <string[]>();
                cmd.CommandText        = "SELECT firstname, lastname from people order by userid";
                using (IDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tuples.Add(new string[] { reader.GetString(0), reader.GetString(1) });
                    }
                }
                return(tuples);
            });

            AssertNames(names);
        }
Ejemplo n.º 4
0
        public async Task CanCopyTableWithTransform()
        {
            await SetupTables();

            using (UsersToPeople process = new UsersToPeople())
                await process.Execute();

            System.Collections.Generic.List <string[]> names = await Database.Transaction("test", async delegate(DbCommand cmd)
            {
                System.Collections.Generic.List <string[]> tuples = new System.Collections.Generic.List <string[]>();
                cmd.CommandText = "SELECT firstname, lastname from people order by userid";
                using (DbDataReader reader = await cmd.ExecuteReaderAsync())
                {
                    while (await reader.ReadAsync())
                    {
                        tuples.Add(new string[] { reader.GetString(0), reader.GetString(1) });
                    }
                }
                return(tuples);
            });

            AssertNames(names);
        }