Closed
Description
Consider this query:
var values = context.Drivers.AsNoTracking()
.Where(e => e.Id == larry.Id)
.Select(e => new object[] { e.Id, e.Name, e.Poles })
.FirstOrDefault();
The types of properties Id, Name, and Poles are int, string, int respectively. So the expectation is that the projected values in the array would be of those types. However, on SQLite, the values are of type long, string, long. That is, the types are the defaults from the store and not the requested types. I expect the same issue would exist on SQL Server in places where the type is relevant.
Note that if I let LINQ to Objects to do the projection:
var values = context.Drivers.AsNoTracking()
.Where(e => e.Id == larry.Id)
.ToList()
.Select(e => new object[] { e.Id, e.Name, e.Poles })
.FirstOrDefault();
then the types in the array are int, string, int, as expected.
However, in the real code I can't use LINQ to Objects for this because I am using EF.Property calls to project shadow values.
This bug currently prevents GetDatabaseValues from working on SQLite.