Inheritance: System.Configuration.Provider.ProviderBase
コード例 #1
0
        private static ProviderBase GetRelationProvider(string providerType)
        {
            try
            {
                RelationProviderBase base2 = null;
                if (string.IsNullOrEmpty(providerType))
                {
                    throw new ArgumentException("Provider type is invalid");
                }
                Type c = Type.GetType(providerType, true, true);
                if (!typeof(RelationProviderBase).IsAssignableFrom(c))
                {
                    throw new ArgumentException(String.Format("Provider must implement type {0}.",
                                                              typeof(RelationProviderBase).ToString()));
                }
                base2 = (RelationProviderBase)Activator.CreateInstance(c);
                var config = new NameValueCollection();
                config.Add("name", providerType);
                base2.ProviderName = providerType;

                base2.Initialize(providerType, config);
                return(base2);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
コード例 #2
0
        public static void Initialize()
        {
            const string fallbackProviderSetting = "EPiCode.Relations.Core.RelationProviders.DynamicDataStoreProvider.DDSRelationProvider";
            string       defaultProviderSetting  = Settings.GetSettingValue("DefaultRelationProviderString");

            if (string.IsNullOrEmpty(defaultProviderSetting))
            {
                defaultProviderSetting = fallbackProviderSetting;
            }

            _defaultProvider = GetRelationProvider(defaultProviderSetting) as RelationProviderBase ??
                               GetRelationProvider(fallbackProviderSetting) as RelationProviderBase;
        }
コード例 #3
0
 public void CopyTo(RelationProviderBase[] array, int index)
 {
     base.CopyTo(array, index);
 }