Пример #1
0
        private void ExecuteProcedure(string connectionString)
        {
            using (var connection = new AseConnection(connectionString))
            {
                var expected   = Guid.NewGuid().GetHashCode();
                var parameters = new DynamicParameters();
                parameters.Add("@RETURN_VALUE", -1, DbType.Int32, ParameterDirection.ReturnValue);
                parameters.Add("@nEchoValueReturn", -1, DbType.Int32, ParameterDirection.Output);
                parameters.Add("@nEchoValue", expected, DbType.Int32, ParameterDirection.Input);

                using (var multi = connection.QueryMultiple("sp_test_echo", parameters, commandType: CommandType.StoredProcedure))
                {
                    var t1Echo = multi.Read <int>().FirstOrDefault();
                    var t2Echo = multi.Read <int>().FirstOrDefault();

                    Assert.AreEqual(expected, t1Echo);
                    Assert.AreEqual(expected + 1, t2Echo);

                    var rReturn = parameters.Get <int>("@RETURN_VALUE");
                    var rOutput = parameters.Get <int>("@nEchoValueReturn");

                    Assert.AreEqual(expected, rReturn);
                    Assert.AreEqual(expected, rOutput);
                }
            }
        }