I am using asp net core in my project with dapper ORM and Postgresql as database. I want to check if a user with a particular UUID (GUID in C#) value exists in the database or not. Following is my code to check the same:
public async Task<bool> DoesRecordExistAsync(Guid columnValue)
{
bool doesRecordExist;
doesRecordExist = await _connection.ExecuteScalarAsync<bool>("SELECT * FROM employee_master WHERE employee_id = @columnValue;", new { columnValue });
return doesRecordExist;
}
Note: _connection is IDbconnection instance.
When executing the statement, I am getting the below error:
Object must implement IConvertible.
Is there anything wrong with the above code.