Replies: 1 comment
-
|
Two problems exist in your code. First problem: Wrong Correct Without the generic argument the compiler cannot match the generic override. Second problem: The overridden method itself is generic. The Wrong Correct Working example Third issue that caused the second error: If nullable reference types are disabled, After those three changes the override should compile. Extending DAB with a Custom Database ExecutorData API builder (DAB) natively supports SQL Server compatible databases, PostgreSQL, MySQL, and Cosmos DB. Prerequisites
1. Project setupCreate a new class-library project and reference the In your <PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>2. Implement
|
| Member | Description |
|---|---|
CreateConnection(string) |
Create and return a new database connection. |
ExecuteQueryAsync<TResult>(...) |
Async query execution with retry. |
ExecuteQuery<TResult>(...) |
Sync query execution with retry. |
ExecuteQueryAgainstDbAsync<TResult>(...) |
Async execution against an open connection. |
ExecuteQueryAgainstDb<TResult>(...) |
Sync execution against an open connection. |
PrepareDbCommand(...) |
Build the DbCommand from SQL text and parameters. |
GetSessionParamsQuery(...) |
Return optional session-context SQL to prepend. |
PopulateDbTypeForParameter(...) |
Set the DbType on a DbParameter. |
SetManagedIdentityAccessTokenIfAnyAsync(...) |
Attach a Managed Identity token to the connection. |
SetManagedIdentityAccessTokenIfAny(...) |
Sync variant of the above. |
GetMultipleResultSetsIfAnyAsync(...) |
Process multiple result sets from a reader. |
ConnectionStringBuilders |
Dictionary mapping data-source names to connection string builders. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to support Oracle database and I cannot seem to be table to override the ExecuteQueryAsync method in OracleQueryExecutor. cs
Class definition: public class OracleQueryExecutor : QueryExecutor
I get this error
'OracleQueryExecutor.ExecuteQueryAsync(string, IDictionary<string, DbConnectionParam>, Func<DbDataReader, List?, Task>?, string, HttpContext?, List?)': return type must be 'Task<TResult?>' to match overridden member 'QueryExecutor.ExecuteQueryAsync(string, IDictionary<string, DbConnectionParam>, Func<DbDataReader, List?, Task>?, string, HttpContext?, List?)'
Tried this as well
public override async Task<TResult?> ExecuteQueryAsync(
string sqltext,
IDictionary<string, DbConnectionParam> parameters,
Func<DbDataReader, List?, Task>? dataReaderHandler,
string dataSourceName,
HttpContext? httpContext = null,
List? args = null)
{
TResult? result = default(TResult);
Got this error
Cannot implicitly convert type 'TResult' to 'TResult?'. An explicit conversion exists (are you missing a cast?)
Beta Was this translation helpful? Give feedback.
All reactions