private static void _selectAndVerifyManually(TypeWithByteArrayField orig, System.Data.IDbConnection db) { using (var cmd = db.CreateCommand()) { cmd.CommandText = @"select ""Content"" from ""TypeWithByteArrayField"" where ""Id"" = 1 --manual select"; using (var reader = cmd.ExecuteReader()) { reader.Read(); var ba = reader["Content"] as byte[]; Assert.AreEqual(orig.Content.Length, ba.Length); Assert.AreEqual(orig.Content, ba); } } }
private static void _insertManually(TypeWithByteArrayField orig, System.Data.IDbConnection db) { using (var cmd = db.CreateCommand()) { cmd.CommandText = @"INSERT INTO ""TypeWithByteArrayField"" (""Id"",""Content"") VALUES (@Id, @Content) --manual parameterized insert"; var p_id = cmd.CreateParameter(); p_id.ParameterName = "@Id"; p_id.Value = orig.Id; cmd.Parameters.Add(p_id); var p_content = cmd.CreateParameter(); p_content.ParameterName = "@Content"; p_content.Value = orig.Content; cmd.Parameters.Add(p_content); cmd.ExecuteNonQuery(); } }