Esempio n. 1
0
        /// <summary>
        /// Enables the DataRepository to programatically create and 
        /// pass in a <c>NetTiersProvider</c> during runtime.
        /// </summary>
        /// <param name="provider">An instatiated NetTiersProvider.</param>
        /// <param name="setAsDefault">ability to set any valid provider as the default provider for the DataRepository.</param>
        public static void LoadProvider(Shmzh.Components.SystemComponent.Provider provider, bool setAsDefault)
        {
            if (provider == null)
                throw new ArgumentNullException("provider");

            if (_providers == null)
            {
                lock (SyncRoot)
                {
                    if (_providers == null)
                        _providers = new Shmzh.Components.SystemComponent.ProviderCollection();
                }
            }

            if (_providers[provider.Name] == null)
            {
                lock (_providers.SyncRoot)
                {
                    _providers.Add(provider);
                }
            }

            if (_provider == null || setAsDefault)
            {
                lock (SyncRoot)
                {
                    if (_provider == null || setAsDefault)
                        _provider = provider as DataProvider;
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Enables the DataRepository to programatically create and 
 /// pass in a <c>NetTiersProvider</c> during runtime.
 /// </summary>
 /// <param name="provider">An instatiated NetTiersProvider.</param>
 public static void LoadProvider(Shmzh.Components.SystemComponent.Provider provider)
 {
     LoadProvider(provider, false);
 }