views:

113

answers:

1

Hi All,

Are there any implications of using SqlDependency and LINQ to SQL together. Or do we have to take care of some things specially to make them work properly?

In our application we are using LINQ to SQL as an ORM and business logic is in the Stored Procedures. We cache the output of the SPs and create SQLDependency. Whenever the output of the SPs change the cache gets invalidated.

Our code so far was working fine in Dev, Test and QA but recently it stopped working in QA and logs suggest that the error is coming from SqlDependency.Start(ConnStr) which is executed in the global.asax file in Application Start block.

The error is as follows: Message : When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance.

But I do not understand that when the SqlDependency.Start() is already executed in Application Start why does it throws exception afterwards when the SPs are executed.

Can anyone throw some light on this problem?

+1  A: 

As SQLDependency is permissions-dependent - did permissions change on the server?

(They probably shouldn't have - but they may!)

Tobiasopdenbrouw
Can you please elaborate on the part of permissions, it will be really helpful and thanks for the reply.
Rishabh Ohri
Generally, setting it up is described here: http://msdn.microsoft.com/en-us/library/a52dhwx7(VS.80).aspxOr see the 'Required Database Permissions' section in http://blogs.msdn.com/b/dataaccess/archive/2005/09/27/474447.aspx
Tobiasopdenbrouw