I'm on XP, SqlSever 2005, .NETfx 3. I'm using SqlDependency to get notifications of changes to my data store. My intent is that when I set up a SqlDependency object, that it will be in effect "forever". However, I find that after 2 minutes or so, changes will not trigger notifications anymore.
I initialize the dependency once per app domain thusly:
SqlDependency
.Start(_connectionString);this._dependencyConnection = new SqlConnection(_connectionString + "Connection Timeout=" + Int32.MaxValue.ToString());
_dependencyConnection.Open();
I set up a new notification (once at startup, and after each notification) like this:
SqlCommand
command = new SqlCommand("SELECT Revision FROM dbo.ConfigData where [Key] = '" + _ourKey + "'", _dependencyConnection); SqlDependency dependency = new SqlDependency(command,null,Int32.MaxValue);dependency.OnChange +=
new OnChangeEventHandler(this.OnChange); SqlDataReader reader = command.ExecuteReader();reader.Close();
This will fire notifcation for a change that happens within 2 minutes or so. After that, nothing. What am I missing here Thanks
Riley