Dapper Extensions is a small library that complements Dapper by adding basic CRUD operations (Get, Insert, Update, Delete) for your POCOs. For more advanced querying scenarios, Dapper Extensions provides a predicate system. The goal of this library is to keep your POCOs pure by not requiring any attributes or base class inheritance.
1.79k
stars
586
forks
source link
Update does not work with guid primary key in PostgreSQL #280
I'm trying to perform Update method, but it fails with execution error:
Npgsql.PostgresException : 42883: operator does not exist: character varying = uuid
Data:
Severity: ERROR
InvariantSeverity: ERROR
SqlState: 42883
MessageText: operator does not exist: character varying = uuid
Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
Position: 104
File: parse_oper.c
Line: 647
Routine: op_error
Model:
public record Account : Entity
{
public string? Name { get; init; }
public string? TokenHash { get; set; }
public string? CertificateThumbprint { get; init; }
public Guid[]? RoleIds { get; init; }
}
public record Entity
{
public Guid Id { get; set; }
}
public Account? Update(Account account)
{
using var connection = _connectionFactory.Create(ConnectionString);
connection.Open();
connection.Update(account);
return account;
}
And table:
CREATE TABLE public.account (
id UUID NOT NULL PRIMARY KEY,
name VARCHAR(255) NULL,
tokenHash VARCHAR(64) NULL,
certificateThumbprint VARCHAR(40) NULL
);
I'm trying to perform
Update
method, but it fails with execution error:Model:
Mapping:
Update method:
And table:
Am i doing something wrong? Please help