/// <summary> /// Gets the lookup table for the property from a lookup cache using <see cref="TableType"/>, and loads it asynchronously as needed. /// </summary> /// <param name="row">Data row for which to get the lookup table, or null if the property is not in a data list object.</param> /// <param name="token">Cancellation token.</param> /// <returns>The lookup table to be used for the property.</returns> protected async virtual Task <LookupTable> GetLookupTableAsync(DataRow row = null, CancellationToken token = default) { LookupCache cache = row?.GetLookupCache(this) ?? LocalCacheLoader?.LocalCache ?? LookupCache.Get(parent?.ServiceProvider ?? DI.DefaultServiceProvider, CacheType); return(await cache?.GetLookupTableAsync(TableType, token)); }
public async Task <IActionResult> GetLookupTableAsync(string type) { LookupTable tbl = await globalCache.GetLookupTableAsync(type); if (tbl == null) { currentErrors.AddError(ErrorType.Data, AspNetCore.Messages.LookupTableNotFound, type); return(StatusCode((int)currentErrors.HttpStatus, new Output(currentErrors))); } else { var output = new Output <LookupTable>(currentErrors, tbl); return(StatusCode((int)output.HttpStatus, output)); } }