public async Task<IEnumerable<DisplayField>> GetLookupFieldsAsync()
{
if (string.IsNullOrWhiteSpace(this.Database))
{
return new List<DisplayField>();
}
if (!this.SkipValidation)
{
if (!this.Validated)
{
await this.ValidateAsync(AccessTypeEnum.Read, this.LoginId, this.Database, false).ConfigureAwait(false);
}
if (!this.HasAccess)
{
Log.Information(
$"Access to get display field for entity \"{this.FullyQualifiedObjectName}\" was denied to the user with Login ID {this.LoginId}",
this.LoginId);
throw new UnauthorizedException("Access is denied.");
}
}
string sql = $"SELECT {this.LookupField} AS \"key\", {this.NameColumn} as \"value\" FROM {this.FullyQualifiedObjectName} WHERE deleted=@0 ORDER BY 1;";
return await Factory.GetAsync<DisplayField>(this.Database, sql, false).ConfigureAwait(false);
}