Quantcast
Channel: SQL Service Broker forum
Viewing all articles
Browse latest Browse all 461

SQL Notification Firing Erratically

$
0
0

Hello everyone and thanks for your help in advance.  I am wokring on a SignalR application.  Within the hub, I have the following code:

    Private Sub dependency_OnChange(sender As Object, e As SqlNotificationEventArgs)
        Dim nHub As New NotificationHub()
        nHub.SendNotifications()
    End Sub

This works but fires multiple multiple times for any single record operation.  I then tried:

    Private Sub dependency_OnChange(sender As Object, e As SqlNotificationEventArgs)
        If e.Type = SqlNotificationType.Change Then
            Dim nHub As New NotificationHub()
            nHub.SendNotifications()
        End If
    End Sub

However, this causes no notification to be issued.  Upon checking, I found the e.Type was equal to "Subscribe".  I then changed the code to utilize SqlNotificationInfo:

        If e.Info = SqlNotificationInfo.Insert _
        Or e.Info = SqlNotificationInfo.Delete _
        Or e.Info = SqlNotificationInfo.Update Then
                 Dim nHub As New NotificationHub()
                 nHub.SendNotifications()   
        End If

However, this doesn't fire either.  I'm not really sure where to go next.  Any help would be greatly appreciated.


Viewing all articles
Browse latest Browse all 461

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>