Skip to content

DateTimeOffset? is evaluted locally since EFCore 2.2.0 #14333

Closed as duplicate

Description

@sebastianfilke

After updating to ef core alle queries with Nullable DateTimeOffset are translated to locally quries. In older version 2.1.x everything was ok.

Steps to reproduce

Here is an example how to get a locally evaluted query.

2019/01/06 11:19:57.106 | Warn | The LINQ expression 'where (([x].EndDate == null) OrElse (Convert([x].EndDate, DateTimeOffset) >= __now_0))' could not be translated and will be evaluated locally.
2019/01/06 11:19:57.106 | Warn | The LINQ expression 'FirstOrDefault()' could not be translated and will be evaluated locally.

public async Task<bool> HasActiveNotification() {
            using (var ctx = PersistenceContextFactory.CreateContext()) {
                var now = DateTimeOffset.Now;

                var notificationEntity = await ctx.Set<NotificationEntity>()
                    .Where(x => x.Active && (x.EndDate.Value == null || x.EndDate.Value >= now)).AsNoTracking().FirstOrDefaultAsync()
                    .ConfigureAwait(false);

                return notificationEntity != null;
            }
        }

Further technical details

EF Core version: 2.2.0
Database Provider: SQLite
Operating system: Xamarin.Forms
IDE: Visual Studio 2017 15.9.4

Activity

  1. ErikEJ commented on Jan 6, 2019

    @ErikEJ
    Contributor

    I believe this is by design (for SQLite)

  2. smitpatel commented on Jan 6, 2019

    @smitpatel
    Contributor

    Duplicate of #14082

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions