I suspect it's because the "ToString" part of your query is being performed in SQL rather than in .NET. You should be able to confirm this by checking the SQL which is being executed.
Try fetching the FromTime
property directly and then call ToString()
on the result instead. You can force processing to be performed at the .NET side using AsEnumerable
if you want to keep it all in a LINQ query:
var time = SomeSimpleQuery.Select(t => t.FromTime)
.AsEnumerable()
.Select(t => new { time = t.ToString() });
If you want to fetch other things, just pass those through:
var query = SomeSimpleQuery.Select(row => new { UserId=row.UserId,
Query=row.Query,
Time=t.FromTime })
.AsEnumerable()
.Select(t => new { t.UserId, t.Query,
Time=t.FromTime.ToString() });