Esempio n. 1
0
        public TestResult Typed_NoParameters()
        {
            return(RunTest(5.5,
                           () =>
            {
                using (var conn = GetOpenConnection())
                    using (var cmd = new SqlCommand("SELECT name, create_date, object_id, schema_id, type FROM sys.all_objects WHERE name = 'sysrowsets'", conn))
                    {
                        var reader = cmd.ExecuteReader();
                        reader.Read();

                        var obj = new SysAllObject {
                            name = (string)reader["name"],
                            create_date = (DateTime)reader["create_date"],
                            object_id = (int)reader["object_id"],
                            schema_id = (int)reader["schema_id"],
                            type = (string)reader["type"]
                        };
                    }
            },
                           () => {
                var obj = DB.GetRow <SysAllObject>("SELECT name, create_date, object_id, schema_id, type FROM sys.all_objects WHERE name = 'sysrowsets'");
            }
                           ));
        }
Esempio n. 2
0
        public TestResult Typed_FiveParameters()
        {
            return(RunTest(10,
                           () =>
            {
                using (var conn = GetOpenConnection())
                    using (var cmd = new SqlCommand("SELECT @Name AS name, @CreateDate AS create_date, @ObjectID AS object_id, @SchemaID AS schema_id, @Type AS type", conn))
                    {
                        cmd.Parameters.Add("@Name", SqlDbType.VarChar, 100).Value = "name";
                        cmd.Parameters.Add("@CreateDate", SqlDbType.DateTime).Value = DateTime.Now;
                        cmd.Parameters.Add("@ObjectID", SqlDbType.Int).Value = 25;
                        cmd.Parameters.Add("@SchemaID", SqlDbType.Int).Value = 27;
                        cmd.Parameters.Add("@Type", SqlDbType.VarChar, 20).Value = "type";

                        var reader = cmd.ExecuteReader();
                        reader.Read();

                        var obj = new SysAllObject {
                            name = (string)reader["name"],
                            create_date = (DateTime)reader["create_date"],
                            object_id = (int)reader["object_id"],
                            schema_id = (int)reader["schema_id"],
                            type = (string)reader["type"]
                        };
                    }
            },
                           () =>
            {
                var obj = DB.GetRow <SysAllObject>("SELECT @Name AS name, @CreateDate AS create_date, @ObjectID AS object_id, @SchemaID AS schema_id, @Type AS type", new {
                    Name = Col.VarChar("name", 100),
                    CreateDate = Col.DateTime(DateTime.Now),
                    ObjectID = 25,
                    SchemaID = 27,
                    Type = Col.VarChar("type", 20)
                });
            }
                           ));
        }
Esempio n. 3
0
        public TestResult Typed_FiveParameters()
        {
            return RunTest(10,
                () =>
                {
                    using (var conn = GetOpenConnection())
                    using (var cmd = new SqlCommand("SELECT @Name AS name, @CreateDate AS create_date, @ObjectID AS object_id, @SchemaID AS schema_id, @Type AS type", conn))
                    {
                        cmd.Parameters.Add("@Name", SqlDbType.VarChar, 100).Value = "name";
                        cmd.Parameters.Add("@CreateDate", SqlDbType.DateTime).Value = DateTime.Now;
                        cmd.Parameters.Add("@ObjectID", SqlDbType.Int).Value = 25;
                        cmd.Parameters.Add("@SchemaID", SqlDbType.Int).Value = 27;
                        cmd.Parameters.Add("@Type", SqlDbType.VarChar, 20).Value = "type";

                        var reader = cmd.ExecuteReader();
                        reader.Read();

                        var obj = new SysAllObject {
                            name = (string)reader["name"],
                            create_date = (DateTime)reader["create_date"],
                            object_id = (int)reader["object_id"],
                            schema_id = (int)reader["schema_id"],
                            type = (string)reader["type"]
                        };
                    }
                },
                () =>
                {
                    var obj = DB.GetRow<SysAllObject>("SELECT @Name AS name, @CreateDate AS create_date, @ObjectID AS object_id, @SchemaID AS schema_id, @Type AS type", new {
                        Name = Col.VarChar("name", 100),
                        CreateDate = Col.DateTime(DateTime.Now),
                        ObjectID = 25,
                        SchemaID = 27,
                        Type = Col.VarChar("type", 20)
                    });
                }
            );
        }
Esempio n. 4
0
        public TestResult Typed_NoParameters()
        {
            return RunTest(5.5,
                () =>
                {
                    using (var conn = GetOpenConnection())
                    using (var cmd = new SqlCommand("SELECT name, create_date, object_id, schema_id, type FROM sys.all_objects WHERE name = 'sysrowsets'", conn))
                    {
                        var reader = cmd.ExecuteReader();
                        reader.Read();

                        var obj = new SysAllObject {
                            name = (string)reader["name"],
                            create_date = (DateTime)reader["create_date"],
                            object_id = (int)reader["object_id"],
                            schema_id = (int)reader["schema_id"],
                            type = (string)reader["type"]
                        };
                    }
                },
                () => {
                    var obj = DB.GetRow<SysAllObject>("SELECT name, create_date, object_id, schema_id, type FROM sys.all_objects WHERE name = 'sysrowsets'");
                }
            );
        }