AngularJS + SignalR real time updates with SQL Server
A quick demo of using AngularJS with SignalR for real time updates. I am thinking of using this type of pattern for all updates. Obviously, there will be times when we need to use web services and webapi etc, but I just think that this is the way to go. What's the difference between the Sql Server version and MongoDB? Well not that much and maybe I could have combined the two. The main difference is in the the id field for each row. For sql server I use a plain old auto incrementing integers. For MongoDB it is a little different in that their id is a BSON ObjectID. A BSON ObjectID is a 12-byte value consisting of a 4-byte timestamp (seconds since epoch), a 3-byte machine id, a 2-byte process id, and a 3-byte counter. Note that the timestamp and counter fields must be stored big endian unlike the rest of BSON. I got into problems moving this field from client to server and eventually used JSON.stringify to pass to SignalR as a string and change from type ObjectID to string. You still have to tell the class about it being an ObjectID with properties though. On the server, just deserialize and away you go. Very keen to move development this way. I will in future raid the Enterprise Library model to get a collection of its tables. From there maybe auto generate the complete screen, a little like Microsoft MVC scaffolding. It will move to Github soon, but in the meantime if you want a copy of the source, just email me at firstname.lastname@example.org Finally moved to github. Too many requests via email but many thanks for them all. Tidied up a little and now also using a little angular ui to show a modal window in response to the delete. https://github.com/admirkb/SignalRRealTimeUpdates And if my server is up you can play with a version at http://www.coolsingel.co.uk/SignalRRealTimeUpdates Let me know what you think via the above email. Currently completing major project to eliminate the pain of css animation. I have a visual designer that builds up the css for you and shows animation in real time. If interested let me know. There will be movie soon Cheers Kelvin
@introducao-a-programacao • UFPE
Ainda não temos comentários aqui
Seja o primeiro!