Prashant Gadekar

Prashant Gadekar

  • 1.6k
  • 143
  • 12.8k

SqlDependency is not working if table has SQL security polic

Aug 6 2019 12:46 AM
I have implemented signalR in my application and tried SqlDependency object to watcher of one of the SQL table. but SqlDependency Change event is not getting fired. I've gone through lots of article but did not get any proper answer and finally I found that table which I am using for watch is having SQL security policy.
 
CREATE SECURITY POLICY [Security].[TaskFilter] ADD FILTER PREDICATE [Security].[functionName]([TASK_ID]) ON [dbo].[tableName] WITH (STATE = ON, SCHEMABINDING = ON) GO
 
Finally I got that SqlDependency doesn't work if you have implemented security policy on table.
 
Kindly help me for this, appreciate in advance.
 
After disabling SQL security policy it works.