sql server 2008 - sqlcachedependency without trigger?
-
23-09-2019 - |
문제
I am so puzzled.
I am using this open-source snippet. I have a table without any triggers in SQL Server, and yet the SQLCacheDependency is working fine. I thought you needed triggers on the table for it to work?!
DateTime localFileTimeStamp = DateTime.Now;
DateTime fileTimeStampInDB;
string cacheKey = string.Format("ImageId_{0}", 1);
object o = Utils.Cache.Get(cacheKey);
if (null == o)
{
// get timestamp from DB
SqlCacheDependency dep;
fileTimeStampInDB = DataLayer.GetTimeStamp(1, out dep);
Utils.Cache.Insert(cacheKey, fileTimeStampInDB, dep, Cache.NoAbsoluteExpiration,
Cache.NoSlidingExpiration);
//, CacheItemPriority.Normal);
//new CacheItemRemovedCallback(WebUtils.CacheItemRemovedCallback));
}
Every time I set the timeupdated field to getdate(), my code detects that object o is null again, which it should, because it should be dropped from the cache after once it's outdated but why is it working? I have just started following tutorials on SQLCacheDependency, so maybe I missed something while reading them.
EDIT: They're using
SqlCacheDependency dependency = new SqlCacheDependency(command);
and I guess this does not require triggers.
Please feel free to share if you dislike this approach and prefer some other approach.
해결책
InfoPath에는 데이터베이스에 직접 피드 할 수있는 양식 서식 파일이 포함되어 있습니다.또한 결과를 XML 파일에 게시 할 수 있습니다. 응답 당 하나씩.웹 폼 기능에 SP가 필요하다고 생각하지만 InfoPath 필러를 사용하여 양식을 채울 수 있지만 변경되지는 않습니다.