3
Follows code:
void OnChange(object sender, SqlNotificationEventArgs e)
{
//from here we will send notification message to client
NotificationHub.SendNotification("João"); // <----- Aqui
....
}
Hub:
public void SendNotification(string who)
{
string name = HttpContext.Current.User.Identity.Name;
foreach (var connectionId in _connections.GetConnections(who))
{
Clients.Client(connectionId).addNotification(name + ": " + "message");
}
}
Line error NotificationHub.SendNotification(Who);
:
An object reference is required for the field, method or non-static "Notificationhub.Sendnotification(string)" property
Some solution ?
@Jubeno, only one detail, in the hub class, problem occurs
Referência de objeto não definida para uma instância de um objeto.'

on the lineClients.Client(connectionId).addNotification(who);
what can be ?– Matheus Miranda
It is not because Clients.Client(connId) returns null?
– Jéf Bueno
Save in a variable this and check if there is any value
– Jéf Bueno
It is returned as null, follows the image: https://postimg.org/image/wkgocwc5d/
– Matheus Miranda
So. You need to find the cause of this
– Jéf Bueno
Great jbueno ! , I asked a new question here: https://answall.com/questions/209573/values-arrivals-nullos-com-sqldep-onchange if you know how to answer, I thank you.
– Matheus Miranda
Opa, I’ll read it now. Even if I know how to solve it may not answer yet (13% battery), but I see when you have more "prepared"
– Jéf Bueno