Exemple #1
0
        public static void CreateDatabase(Paths Paths, string logFileXml2DB, int BuildNumber, DatabaseType databaseType, string connectionString)
        {
            try
            {
                FeaturesContext.Create(Paths.DBfile, databaseType, connectionString);
                var db = FeaturesContext.Open(Paths.DBfile);
                // ANTO DB LOG
                //db.EnableLog();
                var buffer = new DBBuffer();

                /* data insertion in the DB */
                Provider.WriteLogFormat(logFileXml2DB, "Filling up Tables");

                InsertSWPacks(db, buffer, Paths, logFileXml2DB);
                InsertSettingsFamilies(db, buffer, Paths, logFileXml2DB);
                var dictLicenses = InsertLicenses(db, buffer, Paths, logFileXml2DB);
                var dictPhysMod  = InsertPhysicalModels(db, buffer, Paths, logFileXml2DB);
                InsertLogicalModels(db, buffer, dictPhysMod, dictLicenses, Paths, logFileXml2DB);
                InsertTwinLicenses(db, dictLicenses, Paths, logFileXml2DB);
                var dictFeat    = InsertFeatures(db, buffer, dictLicenses, Paths, logFileXml2DB);
                var dictOptions = InsertOptions(db, buffer, dictFeat, Paths, logFileXml2DB);
                InsertApplications(db, buffer, dictFeat, Paths, logFileXml2DB);
                InsertBundles(db, buffer, dictFeat, Paths, logFileXml2DB);
                InsertFeatureRelations(db, buffer, dictFeat, Paths, logFileXml2DB);
                InsertLicenseRelations(db, buffer, Paths, logFileXml2DB);
                InsertLicenseRelationsExceptions(db, buffer, Paths, logFileXml2DB);
                InsertDeprecated(db, buffer, dictFeat, Paths, logFileXml2DB);
                InsertCertifiers(db, buffer, Paths, logFileXml2DB);
                InsertCountries(db, buffer, Paths, logFileXml2DB);
                InsertDistributors(db, buffer, Paths, logFileXml2DB);
                InsertCountryDistributors(db, buffer, Paths, logFileXml2DB);
                InsertCountryLicenses(db, buffer, Paths, logFileXml2DB);
                InsertMinorVersions(db, buffer, Paths, logFileXml2DB);

                ImportRules(db, buffer, dictLicenses, Paths, logFileXml2DB);

                InsertPartNumbers(db, buffer, Paths, logFileXml2DB);
                ImportVersions(db, buffer, Paths, logFileXml2DB);

                buffer.p_UIRules = db.Uirule.ToList();

                Provider.WriteLogFormat(logFileXml2DB, "Convert UIRules to NormalRules");
                db.BulkInsert(FeaturesContext.createNormalRules(buffer));
                SetDBConfigurations(db, BuildNumber);
                Provider.WriteLogFormat(logFileXml2DB, "Database Created");
            }
            catch (Exception ex)
            {
                var errormessage = Provider.WriteErrorLogFormat("Error while creating the Database: " + ex.Message);
                throw new ApplicationException(errormessage, ex);
            }
        }