Using Dapper
var data = new List<uspGetCustomersDynamicSearchPagingSorting>();
using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["DbPaging"].ConnectionString))
{
//var dynamicParams = new DynamicParameters();
//Dictionary<string, object> parameters = new Dictionary<string, object>();
//foreach (var key in parameters.Keys)
//{
// dynamicParams.Add(key, parameters[key]);
//}
//var p = new DynamicParameters();
//p.Add("a", 11);
//p.Add("b", dbType: DbType.Int32, direction: ParameterDirection.Output);
//p.Add("c", dbType: DbType.Int32, direction: ParameterDirection.ReturnValue);
//db.Execute(@"create proc #TestProc @a int, @b int output as begin set @b = 999 select 1111 return @a end");
//db.Query("#TestProc", p, commandType: CommandType.StoredProcedure).FirstOrDefault();
//db.Query("#TestProc", p, commandType: CommandType.StoredProcedure).First().IsEqualTo(1111);
//p.Get("c").IsEqualTo(11);
//p.Get("b").IsEqualTo(999);
var p = new DynamicParameters();
p.Add("CustomersID", null);
p.Add("Name", null);
p.Add("City", null);
p.Add("Email", null);
p.Add("Company", null);
p.Add("PageNbr", startRec / pageSize + 1);
p.Add("PageSize", pageSize);
p.Add("SortCol", string.Empty);
p.Add("totalRecords", dbType: DbType.Int32, direction: ParameterDirection.Output);
data = db.Query<uspGetCustomersDynamicSearchPagingSorting>("uspGetCustomersDynamicSearchPagingSorting", p, commandType: CommandType.StoredProcedure).ToList();
// Total record count.
totalRecords = p.Get("totalRecords");
}