Не могу выполнить мой запрос. У меня есть «Id» в моей базе данных «users», это тип «uuid» postgres, у меня есть идентификатор GUID в ядре dot net, и я хочу получить пользователя с тот же идентификатор и вернуть этого пользователя.
public async Task<T> GetById(Guid entity)
{
try
{
connection.Open();
var result = await this.connection.QueryFirstAsync(askForId, entity);
return result;
}
catch (Exception e)
{
throw e;
}
finally
{
connection.Close();
}
}
Сущность имеет значение:
entity: {675d83ca-c7b6-4efe-bf98-46a48e8a28fd}
Мой запрос таков:
private readonly string askForId = "SELECT * FROM Users WHERE Id = @Id";
Как можно дать Решение этого:
"ClassName": "Npgsql.PostgresException",
"Message": "External component has thrown an exception.",
"Data": {
"Severity": "ERROR",
"InvariantSeverity": "ERROR",
"SqlState": "42883",
"MessageText": "operator does not exist: @ uuid",
"Hint": "No operator matches the given name and argument type. You might need to add an explicit type cast.",
"Position": 32,
"File": "parse_oper.c",
"Line": "731",
"Routine": "op_error"
},
}