1

I'm trying to develop a multi-user application that basically would have a list of some items. Each user is doing some CRUD operations to this list. I need that users see changes to list when other users make some changes.

I thought binding is what I need, but according to information in msdn, DbContext is a Unit of Work/Repository... does this mean that it is not possible for DbContext to read updates from data base automatically?

http://msdn.microsoft.com/en-us/library/system.data.entity.dbcontext(v=vs.103).aspx

Is there a way to get the desired result using Entity Framework?

[EDIT] Is the only way to get updates from database is to use timer with additional code to reload data from database? Is this the only option for real-time apps?

2
  • Depends on how multi-user your multi-user application is. There are some options but it may not scale well to over a few concurrent users. Oct 21, 2013 at 23:22
  • @ScottChamberlain Suppose this is an application for call center - some users register user calls->works in to the list and other users are pulling those works -> assigning who will work with those works. User A needs to know, that user B has already pulled work from unassigend work list. What is the best option to do accomplish this? Use a timer and refresh data from database after each X seconds?
    – Prokurors
    Oct 22, 2013 at 10:22

1 Answer 1

1

DataBinding means a binding between UI and your Objects and not Objects to DataBase.

You need to call a Reload/Refresh method to get the latest database values. Like this: http://stackoverflow.com/questions/16872305/i-do-not-understand-how-ef5-dbcontext-entryentity-reload-method-is-supposed

(See comments)

7
  • Suppose this is an application for call center - some users register user calls->works in to the list and other users are pulling those works -> assigning who will work with those works. User A needs to know, that user B has already pulled work from unassigend work list. What is the best option to do accomplish this? Use a timer and refresh data from database after each X seconds?
    – Prokurors
    Oct 22, 2013 at 10:29
  • 1
    Normally such a scenario is done with push notifications, to minimize the timer overhead when nothing happens. I would implement such a push notification with TCP pakets and listeners on the other side. This can be done with any network protokol, you just need a sender and a listener. You can also have a look at Firebird Database they have something called Server events. firebirdsql.org/file/documentation/papers_presentations/… (thats the first google link, maybe you find something more useful) Oct 22, 2013 at 12:49
  • Hmmm... so maybe there could be a MS SQL trigger that stores an information about what should be refreshed and client app has a timer that checks this small change info table and when there is information about changes - then reloads data from database? You mention firebirdsql db server, but are there solutions that work on MS SQL db server?
    – Prokurors
    Oct 22, 2013 at 13:33
  • 1
    It could be done with MSSQL trigger, but still the overhead stays when nothing is done and you do a timer which checks every x seconds. Just imagine your scenario with 200 users, having a timer that checks every 5 secs if something is new. This would result in 2400 queries every minute, and if there where no change in this minute you have 2400 useless queries because there was nothing to fetch. Instead of 1 TCP Packet send when there is actually something to send, I just mentioned firebird because it has those events build in (they are like tcp packets). I dont know of such a feature in MSSQL. Oct 22, 2013 at 14:33
  • But its not hard to implement yourself, so if you arent familar with opensource databases and prever MSSQL just stick to it and do it your self. Oct 22, 2013 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.