Last post Apr 04, 2012 02:06 AM by docait
Apr 01, 2012 01:47 AM|docait|LINK
I made changes required at DB server side and
void Application_Start(object sender, EventArgs e)
But it gives exception
When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance.
When I put this System.Data.SqlClient.SqlDependency.Start(connstr); call before excuteing query in method it works.
This is not as per best practices I have enable SQL dependent caching in other project
By calling System.Data.SqlClient.SqlDependency.Start(connstr);
In application start.
Only difference in this project we are using sitefinity CMS, I raised my query on their forum but they say
It should work as in normal asp.net projects.
I want to know
1: What is ill impact of calling System.Data.SqlClient.SqlDependency.Start(connstr);
Again and again in methods call.
2: Why application_start approach is not working here
3: How can I enable SQL dependent cache for LINQ to SQL + Stored procedure ?
Apr 02, 2012 04:38 AM|Dave Sussman|LINK
This error may be because Sitefinity does some database stuff earlier in the pipeline, before the main Application_Start runs. You could use a different connection string, that would get around it.
Digging into the code it looks as though calling StartDependency multiple times is safe; it seems to check for a connectionstring key in an internal collection and only create a new one if it's not in the container. I'd not take my word for it though; it
might be best to post that question to a SQL forum.
Apr 04, 2012 02:06 AM|docait|LINK