惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
M
MIT News - Artificial intelligence
D
Docker
量子位
T
Tailwind CSS Blog
人人都是产品经理
人人都是产品经理
月光博客
月光博客
有赞技术团队
有赞技术团队
J
Java Code Geeks
A
About on SuperTechFans
P
Proofpoint News Feed
Jina AI
Jina AI
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
V
V2EX
GbyAI
GbyAI
F
Fortinet All Blogs

博客园 - 眼里进了砂

Unity Application Block 1.2 学习笔记 [转] Unity Application Block 與 ASP.NET MVC 學習資源整理 [转] 线程之间的通讯---SynchronizationContext [转] .NET2.0中WinForm自定义的程序配置[转] 使用BackgroundWorker组件进行异步操作编程[转] .NET页面事件执行顺序[转] 不用设置iis .net 实现urlrewrite[转] 利用XPath读取Xml文件 javascript中replace与正则表达式 c# BackgroundWorker组件介绍(属性、方法、事件) .net 2.0 BackgroundWorker类详细用法 .Net的线程同步方法一:ManualResetEvent .NET应用程序中异步调用Web Service的几种方法 come from: veryhappy(wx.net) [转][javascript] Google谷歌首页点点效果 AJAX 中Sys.WebForms.PageRequestManager的事件激发顺序 AJAX 中Sys.Net.WebRequestManager的事件激发顺序 Summary review about Problem.Design.Solution [转发]深入理解 __doPostBack CSS Tips
Summary review about Problem.Design.Solution 2
眼里进了砂 · 2007-06-04 · via 博客园 - 眼里进了砂

<!-- 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
   {
      [ConfigurationProperty("defaultConnectionStringName",
         DefaultValue = "LocalSqlServer")]
      public string DefaultConnectionStringName
      {
         get { return (string)base["defaultConnectionStringName"]; }
         set { base["connectionStdefaultConnectionStringNameringName"] = value; }
      }
      [ConfigurationProperty("contactForm", IsRequired=true)]
      public ContactFormElement ContactForm
      {
         get { return (ContactFormElement) base["contactForm"]; }
      }
        
public class ContactFormElement : ConfigurationElement
     {
        ..........

     }

      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)
         {
         }