Last post Apr 18, 2013 03:58 AM by Mani Garg
Apr 08, 2013 03:59 AM|binson143|LINK
How i can show live data in UI using signalr or any other method. my data accessing technology is EF, so Insted of using sqldependancy i like to use other tricks
Apr 08, 2013 04:13 AM|XIII|LINK
so Insted of using sqldependancy i like to use other tricks
In that case I suggest you poll your database every second and if there's an update you can push it via SignalR to the UI. You basically need something or some process that triggers the signal when an update has occured in your database.
Why isn't the SqlDependency path an alternative?
Apr 08, 2013 04:23 AM|binson143|LINK
The Problem is with architecture of the application, Which is slice by diffrent layer, the data access layer contains only EF realted technologies.The layer structure is given belwo
Application Service layer
UI [razer views with Knock out MVVM pattern)
So my doubt is where i put the sql SqlDependency ?
Apr 08, 2013 12:11 PM|abergs|LINK
Do you control the various changes to the database or is this done by antother application?
If you control the changes, you can simply add code on your saveToDb()-function that also will push an event out to all clients.
In order to do that, you would simply set up a Hub which your clients connect to, and in order to send a message to the clients from your saveToDb()-function, you could so like they say here:
Send message to all clients:
Setting up a hub: https://github.com/SignalR/SignalR/wiki/Hubs
If you are not in control of updates/inserts of the database, I would recommend polling the database every n-minute/second and look for Highest ID (if you use auto increment) and the total COUNT, to detect changes that have been maid.
Apr 11, 2013 04:55 AM|christiandev|LINK
You can use KnockoutJS for your ViewModel, and a SignalR hub for the communication between EF and the Knockout ViewModel.
You set up the ViewModel with a callback function from the hub, and also set up a call to the hub from the ViewModel.
This way, you shouldn't need to keep polling the database - take a look at the example in
Apr 11, 2013 03:35 PM|kedarrkulkarni|LINK
check my article on the topic
hope this helps...
Apr 18, 2013 03:58 AM|Mani Garg|LINK
You can use trigger concept. Just create a CLR trigger which will notify whenever there is database change. Even you can get which row is updated and just after that use Signal R concept to move this data in real time to UI.
CLR trigger is one of the best approach for getting notification corresponding to database changes. Sql dependency and SqlNotificationRequest are also alternative but they have their own drawback.