Store custom objects configuration in separate custom configuration files

We are going to have a windows service that will run a few workflow(WF) instances. I want to have configuration information to be stored in  separate config files for each WF instance.

I remembered that EntLib has helper classes to store custom objects configuration in separate custom configuration file, but finding good examples in Google wasn’t easy(probably I didn’t find good search keywords).

The links that I finally found(more relevant to the task first)

Tom Hollander ‘post External configuration files in Enterprise Library for .NET Framework 2.0 mostly talks about EntLib provider config sections, but comments are talking about FileConfigurationSource  and custom sections.

Alois Kraus has good articles in his blog : Read/Write App.config with .NET 2.0/Enterprise Library  (and similar in  CodeProject) and Microsoft Enterprise Library for .NET 2.0: Configuration .

Using section handlers to group settings in the configuration file.  shows how to use sections of the types:

  • NameValueSectionHandler
  • DictionarySectionHandler
  • SingleTagSectionHandler 


    Example of separate custom config file Enterprise Library – Configuration Application Block – Patterns and Practices is obsolete(using EntLib 1.0). See Enterprise Library 2.0 – From Configuration Block to IConfigurationSource – SystemConfigurationSource – FileConfigurationSource


    reference: Microsoft.Practices.EnterpriseLibrary.Common.Configuration Namespace

    Alternative implementations from CodeProject without using EntLib are Custom app.config  and A custom configuration file AppSettings reader class


    If you want to add  EntLib Configuration Manager Design time support for editing your sections, look at 

    Enterprise Library Configuration (Part 1/2): Customized Appsettings and the EntLib Configuration Manager tool

    Enterprise Library Configuration (Part 2/2): Customizable configuration with framework extensions  

    Alex Homer: Adding Configuration Support for Custom Providers in Enterprise Library in ASP.NET 2.

    and Enterprise Library 2.0: Building Named Extensions in the Configuration Console

  • Override ASP.NET Menu javascript functions to delay dynamic menus popup.

     We are using Menu control and wanted to have some delay before sub-menu popup to avoid annoying popup, if user just move mouse through menu area.

    After some search on Google I found the solution submitted by yupinggang on the thread delaying the menu control.

    I’ve slightly modified it( put in a separate JS file,call initMenuMouseHoverInterceptors just in the same file,added handling of the case if no menu on the page etc.)


    Another possible solution- override PreRender in derived from Menu control(mentioned in the same thread and in Menu Control – Use OnClick instead of OnMouseOver thread) requires more work and less elegant.

     FILE: Menu_HoverStaticDelay.js

     //    <!– @BEGIN:: JavaScript to prevent the expanding of static menu when you quickly mouse over them –>

    //Example of usage: http://JS/TopNav/Menu_HoverStaticDelay.js

    //loaded from

    //          <!– A big thanks to hdierking for article Polymorphic Javascript –>

    //   <!– Reference website: –>  

                var constShowDelay=500;//ms- configurable

                var constDisappearDelay=800;//ms- configurable

                var myVar;

                var myTimeoutID;

                var myNode, myData;

                var ref_Menu_HoverStatic;

                var ref_Menu_Unhover;

                var ref_overrideMenu_HoverStatic;



                // This function is called in <body onload=”…”>

                function initMenuMouseHoverInterceptors()


                      // *** Interceptors ***

                      // @:: Menu_Hover


                      //handle case if no menu on the page



                          ref_Menu_HoverStatic = Menu_HoverStatic;

                          Menu_HoverStatic = My_Menu_HoverStatic;


                          // @:: Menu_Unhover

                          ref_Menu_Unhover = Menu_Unhover;

                          Menu_Unhover = My_Menu_Unhover;


                          // @:: overrideMenu_HoverStatic

                    ref_overrideMenu_HoverStatic = Menu_HoverStatic;//corrected by skynyrd

                    Menu_HoverStatic = My_overrideMenu_HoverStatic;




                function My_Menu_HoverStatic(item)





                function My_overrideMenu_HoverStatic(item)


                      var node = Menu_HoverRoot(item);

                    var data = Menu_GetData(item);



                    if (!data) return; 


                      myVar = item;                




                function My_DelayExpandMenu(node, data)


                    __disappearAfter = constDisappearDelay; //data.disappearAfter;

                    Menu_Expand(node, data.horizontalOffset, data.verticalOffset);



                function My_Menu_Unhover(item)






    //Global call to initMenuMouseHoverInterceptors seems enough.

    //Alternatively call Page.ClientScript.RegisterStartupScript(Me.GetType, “MyFunction”, “initMenuMouseHoverInterceptors();”, True)

    //Alternatively consider to  call the function initMenuMouseHoverInterceptors() in <body> tag, <body onload=”initInterceptors()” ..>)

    //If using ASP.NET AJAX documentation, call Sys.Application.add_Load or include in  pageLoad function( but only one per page is allowed)

    /*          function pageLoad()






    //   <!– ~END:: JavaScript to prevent the expanding of static menu when you quickly mouse over them –>



    Helper String function to TrimLength

                /// <summary>
                /// If lenght of the string is greater than max allowed, remove the end
                /// </summary>
                /// <param name=”str”></param>
                /// <param name=”maxLength”></param>
                /// <returns></returns>
                public static string TrimLength(string str, int maxLength)
                    if (str.Length > maxLength)
                        str = str.Remove(maxLength);
                    return str;

    Helper function to Print Page using JScript(including inside frame)

                /// Helper function to Print Page using JScript(including inside frame) 
                ///<param name=”page”></param>
                public static void PrintPage(Page page)
                    //In case if page is in frameset, you need to call parent.window.print()
                    String script = @”
    if (parent!= self)
    { parent.window.print();
                    RegisterOnceStartupScript(page,TypeForClientScript(), MethodBase.GetCurrentMethod().Name,script,true);
                public static bool RegisterOnceStartupScript(Page page, Type type,   string key, string script, bool addScriptTags)
                    bool bRet=false;
                        page.ClientScript.RegisterStartupScript(type, key, script, addScriptTags);
                        bRet = true;
                    return bRet;