Exemple #1
0
        private void Construct(string filePath)
        {
            PreConstruct();

            try
            {
                xmlDoc.Load(filePath);
                ValidateXmlDoc();

                FileInfo fileInfo = new FileInfo(filePath);

                if (string.IsNullOrEmpty(Location))
                {
                    Location = fileInfo.DirectoryName;
                    Save();
                }
                else
                {
                    if (string.Compare(fileInfo.DirectoryName, Location, true) != 0)
                    {
                        Location = fileInfo.DirectoryName;
                        Save();
                    }
                }

                string[] Driver = this.CollectedDataDriver.Split(',');

                if (Driver[1].Trim().ToLower() == Configuration.WebDriver.ToLower())
                {
                    this.collectedData.IsWebMode = true;
                    switch (Driver[0].Trim())
                    {
                        case "Epi.Data.MySQL.MySQLDBFactory":
                            this.CollectedDataDriver = Configuration.MySQLDriver;
                            break;
                        case "Epi.Data.Office.AccessDBFactory":
                            this.CollectedDataDriver = Configuration.AccessDriver;
                            break;
                        case "Epi.Data.SqlServer.SqlDBFactory":
                        default:
                            this.CollectedDataDriver = Configuration.SqlDriver;
                            break;
                    }
                }

                this.collectedDataDbInfo.DBCnnStringBuilder.ConnectionString = this.CollectedDataConnectionString;
                collectedData.Initialize(this.collectedDataDbInfo, this.CollectedDataDriver, false);

                if (MetadataSource == MetadataSource.Xml)
                {
                    metadata = new MetadataXmlProvider(this);
                }
                else
                {
                    if (_useMetaDataSet)
                    {
                        metadata = new MetadataDataSet(this);
                    }
                    else
                    {
                        metadata = new MetadataDbProvider(this);
                        if (MetadataSource == MetadataSource.SameDb)
                        {
                            metadata.AttachDbDriver(CollectedData.GetDbDriver());
                        }
                        else
                        {
                            this.metaDbInfo.DBCnnStringBuilder.ConnectionString = this.MetadataConnectionString;
                            metadata.Initialize(this.metaDbInfo, this.MetadataDriver, false);
                        }
                    }
                }
            }
            finally
            {
            }
        }