Suggestion to download my tables with pull #921
Replies: 1 comment
-
I think you are thinking about this wrongly. In a real application, you should create a background service that synchronizes the tables. In the applications I have written, I create a background service that is triggered periodically or via a trigger that a view can use. That background service will just synchronize all the items. If there is a synchronization happening, then an additional request at the same time is just ignored. In my view, I just trigger the synchronization. You can use WorkManager on Android or BGTaskScheduler on iOS, or you can use something like shiny.net - the real "magic" is triggering a service the way you want it. |
Beta Was this translation helpful? Give feedback.
-
I have a view that is linked to a ViewModel ( SynchronizationViewModel ) and is responsible for synchronizing about 20 tables, the way I have divided my application is that each view consumes either 2 to 3 tables and therefore create services, each service that is responsible for querying the store, has a PullItemsAsync() method.
The interesting thing here (for me) is that in a view where I make an initial synchronization, I add all the services to a queue and by means of a while I am executing each service and removing them from the queue. My doubt arises that since I add the services to the queue, these are executed and when it reaches the while they are executed again, this is correct? even if I comment the part where the while executes the tasks, these are processed.
I would like that they could guide me with this doubt, I leave code example:
`public class AccountRepository
{
}
public class AccountService
{
private readonly IAccountRepository _accountRepository = accountRepository;
}
public partial class SynchronizationViewModel : ObservableObject
{
}
`
Beta Was this translation helpful? Give feedback.
All reactions