Exemple #1
0
        public void SP_QueryUser()
        {
            SqlParameterCollection dbParameterCollection = new SqlParameterCollection();

            dbParameterCollection.Add(new SqlParameter("Total", null, typeof(int))
            {
                DbType    = System.Data.DbType.Int32,
                Direction = System.Data.ParameterDirection.Output
            });
            var list = _userRepository.SP_QueryUser(dbParameterCollection);

            Assert.NotNull(list);
            dbParameterCollection.TryGetParameterValue("Total", out int total);
            Assert.NotEqual(0, total);
        }
Exemple #2
0
        public void SP()
        {
            SqlParameterCollection dbParameterCollection = new SqlParameterCollection();

            dbParameterCollection.Add(new SqlParameter("Total", null, typeof(int))
            {
                DbType    = System.Data.DbType.Int32,
                Direction = System.Data.ParameterDirection.Output
            });
            RequestContext context = new RequestContext
            {
                CommandType = System.Data.CommandType.StoredProcedure,
                RealSql     = "SP_QueryUser",
                Request     = dbParameterCollection
            };
            var list = DbSession.Query <User>(context);

            dbParameterCollection.TryGetParameterValue("Total", out int total);
        }
Exemple #3
0
        public void SP()
        {
            SqlParameterCollection dbParameterCollection = new SqlParameterCollection();

            dbParameterCollection.Add(new SqlParameter
            {
                Name      = "Total",
                DbType    = System.Data.DbType.Int32,
                Direction = System.Data.ParameterDirection.Output
            });
            RequestContext context = new RequestContext
            {
                CommandType = System.Data.CommandType.StoredProcedure,
                RealSql     = "SP_Query",
                Request     = dbParameterCollection
            };
            var list = SqlMapper.Query <AllPrimitive>(context);

            dbParameterCollection.TryGetParameterValue("Total", out int total);
        }
        public void SP_SourceParameter()
        {
            SqlParameterCollection dbParameterCollection = new SqlParameterCollection();

            dbParameterCollection.Add(new SqlParameter("Total", null)
            {
                SourceParameter = new Microsoft.Data.SqlClient.SqlParameter("Total", DbType.Int32)
                {
                    Direction = ParameterDirection.Output
                }
            });
            RequestContext context = new RequestContext
            {
                CommandType = CommandType.StoredProcedure,
                RealSql     = "SP_QueryUser",
                Request     = dbParameterCollection
            };
            var list = SqlMapper.Query <User>(context);

            dbParameterCollection.TryGetParameterValue("Total", out int total);
        }
Exemple #5
0
        public void SP_SourceParameter()
        {
            SqlParameterCollection dbParameterCollection = new SqlParameterCollection();

            dbParameterCollection.Add(new SqlParameter("Total", null)
            {
                SourceParameter = new MySqlParameter("Total", DbType.Int32)
                {
                    Direction = ParameterDirection.Output
                }
            });
            RequestContext context = new RequestContext
            {
                CommandType = CommandType.StoredProcedure,
                RealSql     = "SP_Query",
                Request     = dbParameterCollection
            };
            var list = SqlMapper.Query <AllPrimitive>(context);

            Assert.NotNull(list);
            dbParameterCollection.TryGetParameterValue("Total", out int total);
        }