开发者

Configuring SqlCacheDependency in code. Is it possible?

开发者 https://www.devze.com 2023-03-14 15:03 出处:网络
I have the following web.config setting: <caching> <sqlCacheDependency enabled=\"true\"> <databases>

I have the following web.config setting:

<caching>
  <sqlCacheDependency enabled="true">
    <databases>
      <add name="MyDB" pollTime="5000" connectionStringName="MyConnString"/>
    </databases>
  </sqlCacheDependency>
</caching>

Now, for various reasons, I need to set this in code instead and also replace the connectionStringName with the actual connectionString (there are no connection strings defined in the web.config file).

Using System.Data.SqlClient.SqlDependency.Start(...) in 开发者_运维百科Global.asax is not an option.

Anyone know if this is possible?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号