public DataProvider Initialize() { using (LogGroup logGroup = LogGroup.StartDebug("Initializing data provider")) { if (StateAccess.IsInitialized && Config.IsInitialized && !DataAccess.IsInitialized && !isInitialized) { try { //Get the feature's configuration info DataProviderConfiguration qc = (DataProviderConfiguration)ConfigurationManager.GetSection("DataProvider"); if (qc.DefaultProvider == null || qc.Providers == null || qc.Providers.Count < 1) throw new ProviderException("You must specify a valid default provider."); //Instantiate the providers providerCollection = new DataProviderCollection(); ProvidersHelper.InstantiateProviders(qc.Providers, providerCollection, typeof(DataProvider)); providerCollection.SetReadOnly(); defaultProvider = providerCollection[qc.DefaultProvider]; if (defaultProvider == null) { throw new ConfigurationErrorsException( "You must specify a default provider for the feature.", qc.ElementInformation.Properties["defaultProvider"].Source, qc.ElementInformation.Properties["defaultProvider"].LineNumber); } string dataDirectoryPath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath) + Path.DirectorySeparatorChar + "App_Data"; defaultProvider.Exporter.ExportDirectoryPath = dataDirectoryPath + Path.DirectorySeparatorChar + "Exported"; defaultProvider.Importer.ImportableDirectoryPath = dataDirectoryPath + Path.DirectorySeparatorChar + "Legacy"; defaultProvider.Importer.ImportedDirectoryPath = dataDirectoryPath + Path.DirectorySeparatorChar + "Imported"; defaultProvider.Schema.SchemaCommandDirectoryPath = dataDirectoryPath + Path.DirectorySeparatorChar + "Schema"; } catch (Exception ex) { LogWriter.Error(ex.ToString()); initializationException = ex; isInitialized = true; throw ex; } isInitialized = true; //error-free initialization } } return defaultProvider; }
public void CopyTo(DataProvider[] array, int index) { base.CopyTo(array, index); }