2
I’m having a big challenge here and I can’t seem to solve it.
I’m working with DDD
and on the layer of Infra
esotu using Dapper
When trying to execute the following code on RepositorioUsuario
:
public long Adicionar(TEntity entity)
{
using (var connection = _dbConnectionString.Connection())
{
connection.Open();
return connection.Insert<TEntity>(entity);
}
}
Mapping error with the entity:
Npgsql.Postgresexception: '42703: column "Name" of "user" relation does not exist'
This error occurs because in the entity I have a property with the name Nome
and if I change to nome
with the tiny "N", the dapper
can map.
But I don’t want to do that because I want to follow the pattern of names. I know it sounds silly, but it’s too weird to work with properties in lower case.
I’m about to leave the Dapper
and using the ADO
same. I don’t want to use the EF
.
What should I do? try to fix it? change to ADO
? there’s some rule I can’t use ADO
in projects DDD
?
The problem is not Dapper itself, it is the library containing the method
Insert
. Postgresql case sensitive, and Insert is being written based on the name of the properties. You need to check in this library if there is how to configure the generated code to adapt the used Casing.– Jéf Bueno
My problem was with Dapper.Contrib. I am now using Dapper directly without any extensions and it worked. Thank you
– SM_S