Exemplo n.º 1
0
        private static void Initialize()
        {
            providerCollection = new IndexBuilderProviderCollection();

            try
            {
                IndexBuilderConfiguration config
                    = IndexBuilderConfiguration.GetConfig();

                if (config != null)
                {

                    if (
                        (config.Providers == null)
                        || (config.Providers.Count < 1)
                        )
                    {
                        throw new ProviderException("No IndexBuilderProvider found.");
                    }

                    ProvidersHelper.InstantiateProviders(
                        config.Providers,
                        providerCollection,
                        typeof(IndexBuilderProvider));

                }
                else
                {
                    // config was null, not a good thing
                    log.Error("IndexBuilderConfiguration could not be loaded so empty provider collection was returned");

                }
            }
            catch (NullReferenceException ex)
            {
                log.Error(ex);
            }
            catch (TypeInitializationException ex)
            {
                log.Error(ex);
            }
            catch (ProviderException ex)
            {
                log.Error(ex);
            }

            providerCollection.SetReadOnly();

            //}
            //catch (Exception ex)
            //{
            //    log.Error(ex);
            //    initializationException = ex;
            //    isInitialized = false;
            //    //throw ex;
            //    return;
            //}

            //isInitialized = true;
        }
Exemplo n.º 2
0
        private static void Initialize()
        {
            providerCollection = new IndexBuilderProviderCollection();

            try
            {
                IndexBuilderConfiguration config
                    = IndexBuilderConfiguration.GetConfig();

                if (config != null)
                {
                    if (
                        (config.Providers == null) ||
                        (config.Providers.Count < 1)
                        )
                    {
                        throw new ProviderException("No IndexBuilderProvider found.");
                    }

                    ProvidersHelper.InstantiateProviders(
                        config.Providers,
                        providerCollection,
                        typeof(IndexBuilderProvider));
                }
                else
                {
                    // config was null, not a good thing
                    log.Error("IndexBuilderConfiguration could not be loaded so empty provider collection was returned");
                }
            }
            catch (NullReferenceException ex)
            {
                log.Error(ex);
            }
            catch (TypeInitializationException ex)
            {
                log.Error(ex);
            }
            catch (ProviderException ex)
            {
                log.Error(ex);
            }

            providerCollection.SetReadOnly();

            //}
            //catch (Exception ex)
            //{
            //    log.Error(ex);
            //    initializationException = ex;
            //    isInitialized = false;
            //    //throw ex;
            //    return;
            //}

            //isInitialized = true;
        }