We have a web application that consists of a a 3 layered back end (Controller/Biz/Data) with a UI. Our data layer is solely responsible for pulling the data out of the database instance (SQL), the business layer messages the data and creates derived properties, the controller is responsible for sending those changes to the UI.
We have a need to have real-time updates in our application that MUST be tracked at the database level (not the controller level).
We opted to use SQL Dependency and SignalR as our solution.
Everything I have researched about SignalR and SQL Dependency is at the database level, where SQL Dependency will identify the change and broadcast, all within the data layer. For obvious reasons this methodology would bypass the derived properties created in the business layer and give us a different looking object.
The only solution I can think of is to use SQL Dependency to track the changes, dump them into some table/object, then use polling to fetch those from the controller, to the biz layer, to the data layer, and back up.
Your data layer is catching events raised by the database. Have it map the data into the appropriate DTO, then raise an event to be caught by the Business Layer. The Business Layer can then raise an event to the View layer, which can do the SignalR Broadcast(). Bubble up!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With