public string GetKey(int index) { SqlCacheDependencyDatabase db = Get(index); if (db == null) { return(null); } return(db.Name); }
private static void Validate(object value) { if (value == null) { throw new ArgumentNullException("sqlCacheDependencyDatabase"); } SqlCacheDependencyDatabase database = (SqlCacheDependencyDatabase)value; if ((database.PollTime != 0) && (database.PollTime < 500)) { throw new ConfigurationErrorsException(System.Web.SR.GetString("Invalid_sql_cache_dep_polltime"), database.ElementInformation.Properties["pollTime"].Source, database.ElementInformation.Properties["pollTime"].LineNumber); } }
public void Set(SqlCacheDependencyDatabase user) { SqlCacheDependencyDatabase existing = Get(user.Name); if (existing == null) { Add(user); } else { int index = BaseIndexOf(existing); RemoveAt(index); BaseAdd(index, user); } }
private static void Validate(object value) { if (value == null) { throw new ArgumentNullException("sqlCacheDependencyDatabase"); } Debug.Assert(value is SqlCacheDependencyDatabase); SqlCacheDependencyDatabase elem = (SqlCacheDependencyDatabase)value; if (elem.PollTime != 0 && elem.PollTime < 500) { throw new ConfigurationErrorsException( SR.GetString(SR.Invalid_sql_cache_dep_polltime), elem.ElementInformation.Properties["pollTime"].Source, elem.ElementInformation.Properties["pollTime"].LineNumber); } }
public static void Main() { // <Snippet1> // Get the Web application configuration. System.Configuration.Configuration webConfig = WebConfigurationManager.OpenWebConfiguration("/aspnetTest"); // Get the section. string configPath = "system.web/cache/sqlCacheDependency"; System.Web.Configuration.SqlCacheDependencySection sqlDs = (System.Web.Configuration.SqlCacheDependencySection)webConfig.GetSection( configPath); // Get the databases element at 0 index. System.Web.Configuration.SqlCacheDependencyDatabase sqlCdd = sqlDs.Databases[0]; // </Snippet1> // <Snippet2> // Get the current PollTime property value. Int32 pollTimeValue = sqlCdd.PollTime; // Set the PollTime property to 1000 milliseconds. sqlCdd.PollTime = 1000; // </Snippet2> // <Snippet3> // Get the current Name property value. string nameValue = sqlCdd.Name; // Set the Name for this configuration element. sqlCdd.Name = "ConfigElementName"; // </Snippet3> // <Snippet4> // Get the current ConnectionStringName property value. string connectionNameValue = sqlCdd.ConnectionStringName; // Set the ConnectionName property. This is the database name. sqlCdd.ConnectionStringName = "DataBaseName"; // </Snippet4> // <Snippet5> SqlCacheDependencyDatabase dbElement0 = new SqlCacheDependencyDatabase( "dataBase", "dataBaseElement", 500); // </Snippet5> // <Snippet6> SqlCacheDependencyDatabase dbElement1 = new SqlCacheDependencyDatabase( "dataBase1", "dataBaseElement1"); // </Snippet6> }
public void Add(SqlCacheDependencyDatabase name) { BaseAdd(name); }
public void Set(SqlCacheDependencyDatabase user) { BaseAdd(user, false); }
// public methods public void Add(SqlCacheDependencyDatabase name) { BaseAdd(name); }
public void Set(SqlCacheDependencyDatabase user) { }
public void Set (SqlCacheDependencyDatabase user) { SqlCacheDependencyDatabase existing = Get (user.Name); if (existing == null) { Add (user); } else { int index = BaseIndexOf (existing); RemoveAt (index); BaseAdd (index, user); } }