Reputation: 301
I have an application used by many users at the same time. I use Entity Framework to communicate with a PostgreSQL database running on a server. The problem is when an user does an insert on the database, the other users will not see the change.
How can I refresh entities when a change is done on the database automatically?
Thanks
Upvotes: 2
Views: 182
Reputation: 301
Thank you for your answers, I consider this question resolved. I'll use a background worker to refresh some controls of my UI. I think an auto-updater system will be too long to implement and my project comes to the deadline.
Upvotes: 0
Reputation: 34238
There is nothing in EF to do any kind of push notification from the DB.
However that doesn't mean you cant have real-time updates in your UI. Your database is simply a storage bucket, what you will want to do is to send out a notification when you write to your database.
If you are working with a web app something like signalR is good, Below is a little psudocode on how you might do that
context.Things.Add(newThing);
context.SaveChanges();
hubContext.Clients.All().newThingAdded(newThing);
There are many different types of notification techniques, and it depends a lot on the application you are writing which you should use.
Upvotes: 1