I have implemented a unitOfwork pattern that let me handle all the process of consulting the db, but I have been getting some perfomace issues. ex.
public Task<IEnumerable<BooksQueryResult>> GetBooks(int idBook, string Title, string Author)
{
List<SqlParameter> sqlParams = new List<SqlParameter>();
sqlParams.Add(new SqlParameter("idBook", queryParams.IdBook?? SqlString.Null));
sqlParams.Add(new SqlParameter("Title", queryParams.Title?? SqlString.Null));
sqlParams.Add(new SqlParameter("Author", queryParams.Author?? SqlString.Null));
return repos.DbSqlQueryAsync("EXEC usp_getValidBooks @IdBook, @Title, @Author, @DisclosurePeriod
, sqlParams.ToArray());
}
It is supposed to return more than 20k records, but it takes almost 4 min.
Thanks