

























<!-- add on 07/06/04 -->
1. Customize configuration section in Web.Config and handle web events.
<configSections>
<section name="theBeerHouse"
type="MB.TheBeerHouse.TheBeerHouseSection, __code"/>
</configSections>
<theBeerHouse defaultConnectionStringName="LocalSqlServer">
<contactForm mailTo="thebeerhouse@wrox.com"/>
</theBeerHouse>
Specify the name of your customized section in Web.Config file, the content of 'type' stands for the classname, which will be used to handle your customized section.
Create a specific class to handle this(its name needs to be same as the type you specified in Web.Config file), inheriting from ConfigurationSection. Use the [ConfigurationProperty("xxxx", DefaultValue="xxxxxx")] to bind the property to target node.
public class TheBeerHouseSection : ConfigurationSection
public readonly static TheBeerHouseSection Settings =
(TheBeerHouseSection)WebConfigurationManager.GetSection("theBeerHouse");
Note that you need to convert the type of your customized config section in order to create a reference to use.
2. Two approaches to loop through Cache
Loop Recursively by using the IDictionaryEnumerator && Cache.GetEnumerator()
IDictionaryEnumerator enumerator = BizObject.Cache.GetEnumerator();
while (enumerator.MoveNext())
{
if (enumerator.Key.ToString().ToLower().StartsWith(prefix))
}
Loop Recursively by using the DictionaryEntry
foreach (DictionaryEntry de in Cache)此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。