AngularJS SignalR real time updates with MongoDB


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. Whats 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 kelvinadmir.tv

Источник: rutube.ru

Сообщение от Commenton: Необходимо стартовать сессию