Replies: 3 comments 1 reply
|
You have full access to the local db through EF Core DbContext. You can easily remove any data as you please. Just be sure to call SaveChanges without pushing them to remote API - there is SaveChanges overload method for this: You might also want to reset or edit the delta token for given table, if you do this. Those are as well fully accesible through DbContext. |
0 replies
|
something like: foreach (var id in dbContext.MyEntities.Select(e => e.Id))
{
var entity = new MyEntity { Id = id };
dbContext.MyEntities.Attach(entity);
dbContext.MyEntities.Remove(entity);
}
foreach (var deltaToken in dbContext.DatasyncDeltaTokens.Where(x => x.EndsWith("MyEntity")))
{
dbContext.DatasyncDeltaTokens.Remove(deltaToken);
}
await dbContext.SaveChangesAsync(true, false); |
0 replies
|
Thanks. The addToQueue parameter was what I was missing. I didn't see that overload before. @adrianhall Why are you attaching the entities and then removing them? For me this code worked: I just want to make sure there isn't some problem with doing it this way that I am missing. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi, the old version of this library which was under Azure Mobile Apps (https://github.com/Azure/azure-mobile-apps?tab=readme-ov-file) had a method that could be used to wipe all the data from the local table (https://learn.microsoft.com/en-us/previous-versions/azure/developer/mobile-apps/azure-mobile-apps/howto/client/dotnet#purging-entities-in-the-local-database). Is this something that has been considered being added to this library?
All reactions