blazor-workshop icon indicating copy to clipboard operation
blazor-workshop copied to clipboard

System.NotSupportedException: SQLite cannot order by expressions of type 'TimeSpan'

Open Ignatella opened this issue 4 years ago • 0 comments

It seems to be similar to #142. The same issue with TimeSpan format.

Probable solution: to store TimeSpan as long:

TimeSpan myTimeSpan = new TimeSpan(10, 10, 10);
long valueToBeStoredInDb = myTimeSpan.Ticks;

System.NotSupportedException: SQLite cannot order by expressions of type 'TimeSpan'. Convert the values to a supported type or use LINQ to Objects to order the results. at Microsoft.EntityFrameworkCore.Sqlite.Query.Internal.SqliteQueryableMethodTranslatingExpressionVisitor.TranslateOrderBy(ShapedQueryExpression source, LambdaExpression keySelector, Boolean ascending) at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression) at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression) at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)

Ignatella avatar Sep 17 '20 08:09 Ignatella