Exemplo n.º 1
0
        //***************************************************************************
        // Private Methods
        //
        private static void Initialize()
        {
            DynamicMenuProviderConfiguration config =
                (DynamicMenuProviderConfiguration)ConfigurationManager.GetSection("DynamicMenuProvider");

            if (config == null)
            {
                throw new ConfigurationErrorsException("Dynamic menu provider configuration section is not set correctly.");
            }

            _providers = new DynamicMenuProviderCollection();

            System.Web.Configuration.ProvidersHelper.InstantiateProviders(config.Providers, _providers, typeof(DynamicMenuProvider));

            _providers.SetReadOnly();

            _defaultProvider = _providers[config.Default];

            if (_defaultProvider == null)
            {
                throw new ProviderException("No default provider sepecified.");
            }
        }
Exemplo n.º 2
0
        //***************************************************************************
        // Class Constructors
        // 
        #endregion

        #region Private Methods
        //***************************************************************************
        // Private Methods
        // 
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            // Load provider.
            if (!string.IsNullOrEmpty(this._providerName))
                this._provider = DynamicMenuProviderManager.Providers[this._providerName];
            else
                this._provider = DynamicMenuProviderManager.Provider;

            if (this._provider == null)
                throw new Exception("Specified dynamic menu provider name not found or no default provider set.");
        }
        //***************************************************************************
        // Private Methods
        // 
        private static void Initialize()
        {
            DynamicMenuProviderConfiguration config =
                (DynamicMenuProviderConfiguration)ConfigurationManager.GetSection("DynamicMenuProvider");

            if (config == null)
                throw new ConfigurationErrorsException("Dynamic menu provider configuration section is not set correctly.");

            _providers = new DynamicMenuProviderCollection();

            System.Web.Configuration.ProvidersHelper.InstantiateProviders(config.Providers, _providers, typeof(DynamicMenuProvider));

            _providers.SetReadOnly();

            _defaultProvider = _providers[config.Default];

            if (_defaultProvider == null)
                throw new ProviderException("No default provider sepecified.");
        }