Replies: 3 comments
-
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. |
Beta Was this translation helpful? Give feedback.
-
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); |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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?
Beta Was this translation helpful? Give feedback.
All reactions