I want to try using Dapper.Rainbow
mainly to have the ability to use Snapshotter and generate effective updates.
public class MyEntity
{
// ...
public int AK { get; set; }
public int OR { get; set; } //issue is here
// ...
}
My domain has many two-letter named fields, one of them is OR
.
When it comes to insert through Dapper.Rainbow Table
in Database
class, the generated SQL looks like this
INSERT INTO MyEntity (.., AK, OR, ...)
VALUES (...) --SQL syntax is incorrect here, reserved keyword `OR` is used
Is there a way to force using []
so it would be?
INSERT INTO MyEntity (.., [AK], [OR], ...)
VALUES (...) --SQL syntax is fine
EF Core and Dapper.SimpleCRUD work fine for column OR
, but I am looking something more lightweight than EF, but still with some sort of change tracking, so alternatives are also welcome.
As from right now this is not possible in
Dapper.Rainbow
, for creating the query it usesPropertyInfo.Name
and when they are building the query they use just :You can check their Gitub.
It is not bad idea though, you could create a PR for improvements yourself or maybe fork the repo and create your own version of the package.