This commit is contained in:
2020-01-27 18:41:14 +00:00
parent 20728c0224
commit 3b2189de01
3 changed files with 7 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ TODO: look for any line of code that does this or similar: await Task.CompletedT
TODO: Look at any of my middleware code as it's a HOT PATH, make sure it's async db access etc and nothing slowing it down
TODO: Any code at the server that access the db or does file IO MUST be async top to bottom!!
TODO: REFACTOR GetNoLogAsync function is used in many places redundantly when the logging version could do the same thing but not log it with an optional bool switch so refactor that shit
TODO: REFACTOR biz objects have two creates, an async and sync one, WTF is that about? See if can make it just one async version.

View File

@@ -62,7 +62,7 @@ namespace AyaNova.Api.Controllers
try
{
ApiPagedResponse pr = await DataListFetcher.GetResponse(listOptions.DataListKey, ct, Url, nameof(List), listOptions, UserId, UserRoles);
ApiPagedResponse pr = await DataListFetcher.GetResponseAsync(listOptions.DataListKey, ct, Url, nameof(List), listOptions, UserId, UserRoles);
return Ok(new ApiOkWithPagingResponse(pr));
}
catch (System.UnauthorizedAccessException)

View File

@@ -13,7 +13,7 @@ namespace AyaNova.DataList
{
internal static class DataListFetcher
{
internal static async Task<ApiPagedResponse> GetResponse(string DataListKey, AyContext ct, IUrlHelper Url,
internal static async Task<ApiPagedResponse> GetResponseAsync(string DataListKey, AyContext ct, IUrlHelper Url,
string routeName, ListOptions listOptions, long UserId, AuthorizationRoles UserRoles)
{
@@ -117,11 +117,11 @@ namespace AyaNova.DataList
//QUERY THE DB
using (var command = ct.Database.GetDbConnection().CreateCommand())
{
ct.Database.OpenConnection();
await ct.Database.OpenConnectionAsync();
//GET DATA RETURN ROWS
command.CommandText = qDataQuery;
using (var dr = command.ExecuteReader())
using (var dr = await command.ExecuteReaderAsync())
{
while (dr.Read())
{
@@ -155,7 +155,7 @@ namespace AyaNova.DataList
if (f.SqlIdColumnName != null)//skip over df column id, it's not there
{
if (!dr.IsDBNull(nCurrentColumnPointer))
if (!await dr.IsDBNullAsync(nCurrentColumnPointer))
AyaField.i = dr.GetInt64(nCurrentColumnPointer);
nCurrentColumnPointer++;
@@ -168,7 +168,7 @@ namespace AyaNova.DataList
//GET TOTAL RECORD COUNT
command.CommandText = qTotalRecordsQuery;
using (var dr = command.ExecuteReader())
using (var dr = await command.ExecuteReaderAsync())
{
if (dr.Read())
{