91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡(jiǎn)介

1.開(kāi)啟數(shù)據(jù)庫(kù)緩存依賴功能(開(kāi)啟對(duì)數(shù)據(jù)庫(kù)中表ArticleArticleType的緩存)

  (注:)如果要配置SqlCacheDependency,則需要以命令行的方式執(zhí)行。

  aspnet_regsql.exe工具位于Windows\\Microsoft.NET\\Framework\\[版本]文件夾中。

  

aspnet_regsql -C "data source=WIN-2FNH16TMA0F\HZM;initial catalog=Sngovweb_sta3;user id=Sngovweb_sta;password=sngo1234...." -ed -et -t "dbo.Article"
aspnet_regsql -C "data source=WIN-2FNH16TMA0F\HZM;initial catalog=Sngovweb_sta3;user id=Sngovweb_sta;password=sngo1234...." -ed -et -t "dbo.ArticleType"
2.配置Web.config文件
<connectionStrings>
//實(shí)體框架生成的數(shù)據(jù)庫(kù)連接字符串
<add name="SimpleNewsContext" connectionString="metadata=res://*/SimpleNews.csdl|res://*/SimpleNews.ssdl|res://*/SimpleNews.msl;provider=System.Data.SqlClient;provider connection string="data source=WIN-2FNH16TMA0F\HZM;initial catalog=Sngovweb_sta3;persist security info=True;user id=Sngovweb_sta;password=sngo1234....;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
//新增數(shù)據(jù)庫(kù)連接字符串
<add name="test" connectionString="data source=WIN-2FNH16TMA0F\HZM;initial catalog=Sngovweb_sta3;persist security info=True;user id=Sngovweb_sta;password=sngo1234....;multipleactiveresultsets=True;"/>
</connectionStrings>
<system.web>
<caching>
<sqlCacheDependency enabled="true" pollTime="10000">
<databases>
<add name="SimpleNews" connectionStringName="test" />//這個(gè)連接字符串名稱不是實(shí)體框架生成的那個(gè),而是自己手動(dòng)添加的
</databases>
</sqlCacheDependency>
</caching>
</system.web>
3.在控制器的方法上打上[OutputCache]標(biāo)簽
[OutputCache(Duration = 86400, SqlDependency = "SimpleNews:dbo.Article;SimpleNews:dbo.ArticleType")]
public ActionResult Index()
{
return View();
}

 

資源截圖

代碼片段和文件信息

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件??????57117??2015-10-22?15:55??Asp.net?mvc+EF+Sql?Server2008數(shù)據(jù)庫(kù)緩存依賴.docx

-----------?---------??----------?-----??----

????????????????57117????????????????????1


評(píng)論

共有 條評(píng)論

相關(guān)資源