ok so they didn't add the functionality for the sql dependencies and notifications into the enterprise library, so this is what i came up with so far as a wrapper:
public class SqlExpiration : Microsoft.Practices.EnterpriseLibrary.Caching.ICacheItemExpiration, IDisposable
{
private SqlCacheDependency dp = null;
private string database = string.Empty;
private string table = string.Empty;
public SqlExpiration(string database, string table)
{
this.table = table;
this.database = database;
dp = new SqlCacheDependency(database, table);
}
#region ICacheItemExpiration Members
public bool HasExpired()
{
return dp.HasChanged;
}
public void Initialize(Microsoft.Practices.EnterpriseLibrary.Caching.CacheItem owningCacheItem)
{
}
public void Notify()
{
}
#endregion
#region IDisposable Members
public void Dispose()
{
if (dp != null)
{
dp.Dispose();
}
}
#endregion
}
am i missing anything? it seems to work fine i just have no idea
Harold.NET
Contributor
2231 Points
458 Posts
Enterprise Library Caching and Sql Dependencies
Sep 27, 2006 09:08 PM|LINK
ok so they didn't add the functionality for the sql dependencies and notifications into the enterprise library, so this is what i came up with so far as a wrapper:
public class SqlExpiration : Microsoft.Practices.EnterpriseLibrary.Caching.ICacheItemExpiration, IDisposable { private SqlCacheDependency dp = null; private string database = string.Empty; private string table = string.Empty; public SqlExpiration(string database, string table) { this.table = table; this.database = database; dp = new SqlCacheDependency(database, table); } #region ICacheItemExpiration Members public bool HasExpired() { return dp.HasChanged; } public void Initialize(Microsoft.Practices.EnterpriseLibrary.Caching.CacheItem owningCacheItem) { } public void Notify() { } #endregion #region IDisposable Members public void Dispose() { if (dp != null) { dp.Dispose(); } } #endregion }am i missing anything? it seems to work fine i just have no idea