Open nofalfayyaz opened 5 years ago
Hi Nofal,
Please note that an item that is added in NCache with SQLDependency will automatically get removed if the provided SQLDependency Query is invalid. There are a few limitations imposed by SQL Broker that need to be addressed when you are creating a query for SQLDependency. The reason why your item gets immediately removed from cache upon insertion might be because your SQLDependency Query does not fulfill the requirements provided by Microsoft.
I am sharing the link to Microsoft's official document for SQLDependency Query creation. Please reconstruct your query based on these rules and it should fix your NCache SQLDependency issue.
Supported SQL Statements for SQLDependency: https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008-r2/ms181122(v=sql.105)
We are trying to implement SqlCacheDependency and while adding the dependency through Stored Procedure it remove the object immediately after adding it to cache.It gives CacheItemRemovedReason as 4.
It shows the same behavior if we select all columns of a table (using * instead of using columns name) for query that selects the data on which the key is dependent, it start popping item out of cache immediately after inserting.
We have used the Database Synchronization sample provided in mentioned below link.
http://www.alachisoft.com/resources/samples/
SQL Server Version : Microsoft SQL Server 2008 R2 (SP2)
Alachisoft Edition : Enterprise Trial Version
Alachisoft SDK version : 4.9.1.1