Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class SqliteObjectToStringTranslator : IMethodCallTranslator
typeof(byte),
typeof(byte[]),
typeof(char),
typeof(DateOnly),
typeof(DateTime),
typeof(DateTimeOffset),
typeof(decimal),
Expand All @@ -29,6 +30,7 @@ public class SqliteObjectToStringTranslator : IMethodCallTranslator
typeof(long),
typeof(sbyte),
typeof(short),
typeof(TimeOnly),
typeof(TimeSpan),
typeof(uint),
typeof(ushort)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@ private static readonly IReadOnlyDictionary<ExpressionType, IReadOnlyCollection<
{
[ExpressionType.Add] = new HashSet<Type>
{
typeof(DateOnly),
typeof(DateTime),
typeof(DateTimeOffset),
typeof(TimeOnly),
typeof(TimeSpan)
},
[ExpressionType.Divide] = new HashSet<Type> { typeof(TimeSpan), typeof(ulong) },
[ExpressionType.Divide] = new HashSet<Type>
{
typeof(TimeOnly),
typeof(TimeSpan),
typeof(ulong)
},
[ExpressionType.GreaterThan] = new HashSet<Type>
{
typeof(DateTimeOffset),
Expand All @@ -49,11 +56,18 @@ private static readonly IReadOnlyDictionary<ExpressionType, IReadOnlyCollection<
typeof(ulong)
},
[ExpressionType.Modulo] = new HashSet<Type> { typeof(ulong) },
[ExpressionType.Multiply] = new HashSet<Type> { typeof(TimeSpan), typeof(ulong) },
[ExpressionType.Multiply] = new HashSet<Type>
{
typeof(TimeOnly),
typeof(TimeSpan),
typeof(ulong)
},
[ExpressionType.Subtract] = new HashSet<Type>
{
typeof(DateOnly),
typeof(DateTime),
typeof(DateTimeOffset),
typeof(TimeOnly),
typeof(TimeSpan)
}
};
Expand Down Expand Up @@ -120,7 +134,8 @@ protected override Expression VisitUnary(UnaryExpression unaryExpression)
visitedExpression.Type);
}

if (operandType == typeof(TimeSpan))
if (operandType == typeof(TimeOnly)
|| operandType == typeof(TimeSpan))
{
return QueryCompilationContext.NotTranslatedExpression;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ public override async Task Where_TimeOnly_IsBetween(bool async)
public override async Task Where_TimeOnly_subtract_TimeOnly(bool async)
{
// TimeSpan. Issue #18844.
await Assert.ThrowsAsync<InvalidCastException>(() => base.Where_TimeOnly_subtract_TimeOnly(async));
await AssertTranslationFailed(() => base.Where_TimeOnly_subtract_TimeOnly(async));

AssertSql();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public override Task Where_TimeOnly_IsBetween(bool async)

public override Task Where_TimeOnly_subtract_TimeOnly(bool async)
// TimeSpan. Issue #18844.
=> Assert.ThrowsAsync<InvalidCastException>(() => base.Where_TimeOnly_subtract_TimeOnly(async));
=> AssertTranslationFailed(() => base.Where_TimeOnly_subtract_TimeOnly(async));

private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public override Task Where_TimeOnly_IsBetween(bool async)

public override Task Where_TimeOnly_subtract_TimeOnly(bool async)
// TimeSpan. Issue #18844.
=> Assert.ThrowsAsync<InvalidCastException>(() => base.Where_TimeOnly_subtract_TimeOnly(async));
=> AssertTranslationFailed(() => base.Where_TimeOnly_subtract_TimeOnly(async));

private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);
Expand Down