We are going from using Dapper to using Entity framework. There is this method that should return number of liters for a given Id.
Example:
|-----|--------|
| Id | Litres |
|-----|--------|
| 1 | 2.75 |
|-----|--------|
| 1 | 2.113 |
|-----|--------|
| 2 | 1.23 |
|-----|--------|
Result should in this case be:
id: 1 SumLitres: 4.863 id: 2 SumLitres: 1.23
In the actual case there are thousands of entries and the prescision of the sum of these are different when using dapper and Linq. We can accept 3 decimal prescision, but not lower than that.
The dapper query:
const string query = @"
SELECT Id, Sum(Litres) as Litres
FROM Litres
GROUP BY Id;
The linq query:
context.Litres.Select(x => new { x.Id, x.Litres})
.GroupBy(x => x.Id)
.AsNoTracking()
.ToList()
.Select(g => new { Id = g.Key, Litres = g.Sum(s => s.Litres) })
.ToList();
The problem is that the results differ in second decimal place and i dont know which of these to queries gives the result with highest precision?
Anyone knows how to increase the precision or which one has the highest?
The column Litres has the datatype: real.