/// <summary>
        /// Compares current generated database model (from DSL scripts)
        /// and the previously created objects in database (from metadata in table Rhetos.AppliedConcept).
        /// </summary>
        public DatabaseDiff Diff()
        {
            var stopwatch = Stopwatch.StartNew();

            var oldApplications = _conceptApplicationRepository.Load();

            _performanceLogger.Write(stopwatch, "Loaded old concept applications.");

            var newApplications = ConceptApplication.FromDatabaseObjects(_databaseModel.DatabaseObjects);

            _performanceLogger.Write(stopwatch, "Got new concept applications.");

            MatchAndComputeNewApplicationIds(oldApplications, newApplications);
            _performanceLogger.Write(stopwatch, "Match new and old concept applications.");

            ConceptApplication.CheckKeyUniqueness(newApplications, "generated, after matching");
            _performanceLogger.Write(stopwatch, "Verify new concept applications' integrity.");

            newApplications = TrimEmptyApplications(newApplications);
            _performanceLogger.Write(stopwatch, "Removed unused concept applications.");

            var diff = CalculateApplicationsToBeRemovedAndInserted(oldApplications, newApplications);

            _performanceLogger.Write(stopwatch, "Analyzed differences in database structure.");
            return(diff);
        }
Beispiel #2
0
        public List <ConceptApplication> Load()
        {
            var previoslyAppliedConcepts = LoadOldConceptApplicationsFromDatabase();

            ConceptApplication.CheckKeyUniqueness(previoslyAppliedConcepts, "loaded");

            var dependencies = LoadDependenciesFromDatabase();

            EvaluateDependencies(previoslyAppliedConcepts, dependencies); // Replace GUIDs with actual ConceptApplication instances.

            return(previoslyAppliedConcepts);
        }