forked from praeclarum/sqlite-net
-
Notifications
You must be signed in to change notification settings - Fork 160
Open
Labels
Description
I am currently using the initial SQLite-net source, but I just checked the source on this project and see that it is the same.
On the TableQuery CompileExpr method, MemberExpressions only check for ExpressionType.Parameter. If the ExpressionType is Convert, an exception is thrown. Is there a reason for this since if the check is changed to the following, it still works in a scenario that I need it for - if (mem.Expression!=null && (mem.Expression.NodeType == ExpressionType.Parameter || mem.Expression.NodeType == ExpressionType.Convert)) {
This is also the case in the AddOrderBy method. I assume in other places also, but for now it is the only places that I picked it up according to my code.
A sample method that I use to replicate my issue:
public async Task<DateTime> GetLatestModifiedDateAsync<T>() where T : IEntity, new()
{
var result = await db.Table<T>()
.OrderByDescending(e => e.ModifiedAt)
.FirstOrDefaultAsync();
return result != null ? result.ModifiedAt : new DateTime(1900, 1, 1);
}