Quantcast
Channel: SignalR and Sql Server
Viewing all articles
Browse latest Browse all 5

Re: SignalR and Sql Server

0
0

In the notification hub I am having to pass multiple numbers to the client. 34 total. The source for these numbers will be 4 stored procedures. I've decided to use  Linq to Sql to call the first stored procedure which returns 5 numbers. I've been searching for information on how to handle the SqlDependency. In all the tutorials I have looked at the SqlDependecy relies on the SqlCommand Object, however in my case I am not using SqlCommand. Does anyone know of information, that would show me how to handle SqlDependency in this case?

Thank-you

  [HubMethodName("sendNotifications")]
         public void SendNotifications()
        {
            dbDataContext db = new dbDataContext();
            var Line1 = db.sp_IndivBoxCount("1", "IBL");
            var Line2 = db.sp_IndivBoxCount("2", "IBL");
            var Line3 = db.sp_IndivBoxCount("3", "IBL");
            var Line4 = db.sp_IndivBoxCount("4", "IBL");
            var Line5 = db.sp_IndivBoxCount("5", "IBL");

            SqlCommand command = null;
            SqlDependency dependency = new SqlDependency(command);

            OnChangeEventHandler dependency_OnChange = null;
            dependency.OnChange += new OnChangeEventHandler(dependency_OnChange);

          
            IHubContext context = GlobalHost.ConnectionManager.GetHubContext<NotificationHub>();
            context.Clients.All.RecieveNotification(Line1,Line2,Line3,Line4,Line5);
        }


Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images