c# - 仅具有过去 10 天脱机同步 PullAsync 行的 MobileServiceClient

标签 c# azure uwp azure-mobile-services

我正在尝试从同步表中创建过去 10 天的“新增内容”类型的列表。

我不想同步整个表,因为它包含数万行或过去 10 天具有 CreatedAt 的行。

await App.syncTablePersonStringChange.PullAsync(
    "whtsnew",
    App.syncTablePersonStringChange.Where(x=>DateTimeOffset.UtcNow.Subtract(x.CreatedAt) <= TimeSpan.FromDays(10)),
    false,
    new CancellationToken(),
    new PullOptions());

我已经尝试了上面的代码,但是需要很长时间(永远不会完成)。

没有错误。

最佳答案

问题在于您的 where 语句。我已尝试过您的声明,但收到 NotSupportException:

System.NotSupportedException: The member 'Subtract' is not supported in the 'Where' Mobile Services query expression.

这对我有用:

.Where(x => x.CreatedAt >= DateTimeOffset.UtcNow.AddDays(-10));

但在此语句中,CreatedAt偏移将被忽略...

关于c# - 仅具有过去 10 天脱机同步 PullAsync 行的 MobileServiceClient,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45002396/

相关文章:

c# - 没有设置 UseSubmitBehavior ="false"ASP.Net 按钮 OnClick 不会启动

.net - 上次调试 session 的应用程序见解

windows - UWP 应用程序关闭时运行后台任务

c# - Entity Framework - SQL Server 2005 - IIS 服务器日期时间问题

c# - 使用 Jira 6.4.3 将附件发布到 Rest api

c# - 如何取消阻塞已调用 AutoResetEvent 对象上的 WaitOne 方法的线程?

Java 客户端 SDK - ModuleClient : Exception when using CreateFromEnvironment

azure - Azure的 "Service Configuration"存储在哪里?

events - ItemInvoked 与 SelectionChanged

ffmpeg - 在 UWP 中转码视频