Microsoft.AspNet.SignalR.SqlServer.IDbCommandExtensions.AddSqlDependency C# (CSharp) Method

AddSqlDependency() public static method

public static AddSqlDependency ( this command, Action callback ) : void
command this
callback Action
return void
        public static void AddSqlDependency(this IDbCommand command, Action<SqlNotificationEventArgs> callback)
        {
            var sqlCommand = command as SqlCommand;
            if (sqlCommand == null)
            {
                throw new NotSupportedException();
            }

            var dependency = new SqlDependency(sqlCommand, null, (int)_dependencyTimeout.TotalSeconds);
            dependency.OnChange += (o, e) => callback(e);
        }