ASP.NET 2.0 ÖеÄSqlCacheDependencyÌØÐÔ
Ëü»¹»áÔÚÖ¸¶¨µÄÊý¾Ý¿âÖÐÔö¼Ó¼¸¸ö´æ´¢¹ý³Ì£¬ÓÃÀ´ÈÃASP.NETÒýÇæ²éѯ׷×ÙµÄÊý¾Ý±íµÄÇé¿ö¡£
È»ºó£¬Ëü»á¸øÎÒÃÇҪ׷×ÙµÄTable¼ÓÉϼ¸¸öTrigger£¬·Ö±ð¶ÔÓ¦µ½Insert¡¢Update¡¢Delete²Ù×÷£¬Õ⼸¸öTriggerµÄÓï¾ä·Ç³£¼òµ¥£¬¾ÍÊÇ°Ñ“AspNet_SqlCacheTablesForChangeNotification”±íÖжÔÓ¦“tableName”×Ö¶ÎΪÕâ¸ö×·×ٵıíµÄÃû³ÆµÄ¼Ç¼µÄ“changeId”×ֶμÓÉÏÒ»¸ö1¡£
ASP.NETÒýÇæͨ¹ýÖ´ÐÐËü¼ÓÉϵĴ洢¹ý³Ì“AspNet_SqlCachePollingStoredProcedure”£¬Õâ¸ö´æ´¢¹ý³ÌÖ±½Ó·µ»Ø“AspNet_SqlCacheTablesForChangeNotification”±íµÄÄÚÈÝ£¬ÈÃASP.NETÒýÇæÖªµÀÄĸö±íµÄÊý¾Ý·¢ÉúµÄ±ä»¯¡£Ä¬ÈÏÿ500ºÁÃëÖ´ÐÐÕâ¸ö´æ´¢¹ý³ÌÒ»´Î£¬²»¹ý¿ÉÒÔÔÚweb.configÀïÃæÐÞ¸ÄÕâ¸ö¼ä¸ôʱ¼ä£¬ÎҵľÑéÊÇÕâ¸ö²éѯ²Ù×÷Ò²ÊǺܺÄ×ÊÔ´µÄ£¬ºÇºÇ¡£
2¡¢ web.configÅäÖÃ
ÔÚweb.configÀïÃæµÄÅäÖÃÔÙ¼òµ¥²»¹ýÁË
<configuration>
<!-- ¼ÓÉϺÏÊʵÄÊý¾Ý¿âÁ¬½Ó×Ö·û´® -->
<connectionStrings>
<add name="SqlServerConnectionString"
connectionString="server=sqlserver1;uid=sa;pwd=
password;database=PortalDB " />
</connectionStrings>
<system.web>
<!-- ÅäÖÃCacheÒ»¶Î£¬Ê¹Ö®Ö§³ÖSqlCacheDependency -->
<cache>
<sqlCacheDependency enabled="true" pollTime="500">
<databases>
<add name=" PortalDB "
connectionStringName=" SqlServerConnectionString " />
Ïà¹ØÎĵµ£º
ÍêÕû´úÂëÈçÏ£º02_ClientCentric.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="02_ClientCentric.aspx.cs" Inherits="ClientCentric" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="h ......
Asp.netÖÐDataBinder.EvalÓ÷¨µÄ×ܽá
<%# Bind("Subject") %> //°ó¶¨×Ö¶Î
<%# Container.DataItemIndex + 1%> //ʵÏÖ×Ô¶¯±àºÅ
<%# DataBinder.Eval(Container.DataItem, "[n]") %>
ͨ³£Ê¹Óõķ½·¨(ÕâÈý¸öÐÔÄÜ×îºÃ)
<%# DataBinder.Eval(Container.DataItem, "ColumnName") %>
<%# DataBi ......
ÔÚʹÓÃÍøÕ¾¹ÜÀí¹¤¾ß×öµÇ¼ҳÃæµÄʱºòÓöµ½µÄÎÊÌâ
ËùÓöÎÊÌ⣺½øÈëVisual Studio 2005µÄ“ÍøÕ¾”²Ëµ¥µÄ“ASP.NET ÅäÖԺ󣬵ã»÷“°²È«”ºó£¬³öÏÖÈçϵijö´íÐÅÏ¢£º
“Ñ¡¶¨µÄÊý¾Ý´æ´¢Çø³öÏÖÎÊÌ⣬ÔÒò¿ÉÄÜÊÇ·þÎñÆ÷Ãû³Æ»òƾ¾ÝÎÞЧ£¬»òÕßȨÏÞ²»×ã¡£Ò²¿ÉÄÜÊÇ ......
ÈÎÖ°×ʸñ:
1. ´óѧ±¾¿ÆÒÔÉÏѧÀú£¬ÈýÄêÒÔÉÏÈí¼þ¿ª·¢¹¤×÷¾Ñé»ò»¥ÁªÍø¿ª·¢¾Ñ飻¾ßÓжþ¸ö¼°ÒÔÉÏÖÐÐÍÏîÄ¿µÄ³É¹¦ÊµÊ©¾Ñ飻
2. ÓÐ׼ȷÀí½âÐèÇ󡢼ܹ¹ÄÜÁ¦£¬ÓнÏÇ¿µÄ³ÌÐòÉè¼ÆÄÜÁ¦, ÊìϤÃæÏò¶ÔÏó·ÖÎö¡¢Èí¼þ¹¤³Ì¡¢UMLµÈÏà¹Ø¼¼Êõ£»
3. ÊìÁ·ÕÆÎÕ¼ÆËã»ú±à³ÌÒ»°ã˼ÏëºÍ·½·¨£»ÊìϤһÖÁÁ½ÖÖÃæÏò¶ÔÏó±à³ÌÓïÑÔ£»¾«Í¨.NET¡¢ C#¡¢ASP.net¡ ......