System.Data.Common.DbConnection.ExecuteExpandoObject(string, System.Data.Common.DbParameter[])

Here are the examples of the csharp api class System.Data.Common.DbConnection.ExecuteExpandoObject(string, System.Data.Common.DbParameter[]) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

View license
[TestMethod]
        public void ExecuteExpandoObject()
        {
            string sql = "SELECT 1 AS IntColumn, 'FizzBuzz' AS StringColumn WHERE @Fizz = 1";
            var dict = new Dictionary<string, object> {{"@Fizz", 1}};

            // Examples
            using (var conn = new SqlConnection(My.Config.ConnectionString.UnitTest.ConnectionString))
            {
                conn.Open();
                dynamic entity = conn.ExecuteExpandoObject(sql, dict.ToDbParameters(conn));

                // Unit Test
                Assert.AreEqual(1, entity.IntColumn);
                Assert.AreEqual("FizzBuzz", entity.StringColumn);
            }
        }