We switched from dapper to dapper plus for performance in bulk inserts.
Now I am converting all the existing queries but I found some functionality that I apparently cannot do with dapper plus (or I don't know how yet)
In my previous query I round the values inside the query, and I converted that to this:
DapperPlusManager.Entity<Model>().Table("Table").Identity("ID")
.Map(x => x.Id, "ID")
.Map(x => x.Timestamp, "Timestamp")
.Map(x => x.Latitude, "GPS latitude")
.Map(x => x.Longitude, "GPS longitude")
.Map(x => x.Direction, "ROUND(Direction (°)::numeric, 1)")
.Map(x => x.Speed, "ROUND(Speed (kph)::numeric, 1)")
.Map(x => x.DeviceId, "DEVICE_ID");
But apparently rounding inside the column name is not really working. Is there another way to solve this?
It could be possible to make the rounding in the database but this is easier to do it during the mapping.
DapperPlusManager.Entity<Model>().Table("Table").Identity("ID")
.Map(x => x.Id, "ID")
.Map(x => x.Timestamp, "Timestamp")
.Map(x => x.Latitude, "GPS latitude")
.Map(x => x.Longitude, "GPS longitude")
.Map(x => Math.Round(x.Direction), "Direction")
.Map(x => Math.Round(x.Speed), "Speed")
.Map(x => x.DeviceId, "DEVICE_ID");
If you need to absolutely do it in the database, let me know and I will update my answer.