Ejemplo n.º 1
0
        /// <summary>
        /// Reverts part of the schema relevant to a problem to the state which when compared to its current
        /// state, regenerates the problem. The inverse of ResolveProblem.
        /// </summary>
        /// <param name="oldSchema">the old schema which generated the problem when compared to the current schema</param>
        /// <param name="problem">the problem it generated</param>
        public void ApplyProblem(ContentModelSchema oldSchema, ChangeProblem problem)
        {
            string aqTypeName = problem.GetAssemblyQualifiedTypeName();

            switch (problem.ProblemType)
            {
            case ChangeProblemType.DeletionNeeded:
                // copy the deleted type to the new schema
                TypeProperties.Add(aqTypeName, oldSchema.TypeProperties[aqTypeName]);
                break;

            case ChangeProblemType.PropertyDropped:
                // copy the dropped property to the new schema
                TypeProperties[aqTypeName].Add(problem.PropertyName, oldSchema.TypeProperties[aqTypeName][problem.PropertyName]);
                break;

            case ChangeProblemType.PropertyDroppedFromSummary:
                Type   contentType       = ContentTypeHierarchy.GetContentType(problem.TypeName);
                string aqSummaryTypeName = ContentTypeHierarchy.SummaryTypes[contentType].AssemblyQualifiedName;
                TypeProperties[aqTypeName].Add(problem.PropertyName, oldSchema.TypeProperties[aqTypeName][problem.PropertyName]);
                TypeProperties[aqSummaryTypeName].Add(problem.PropertyName, oldSchema.TypeProperties[aqSummaryTypeName][problem.PropertyName]);
                break;

            // Problems not requiring data modification
            case ChangeProblemType.NullObjectValue:
                break;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates this schema so it can no longer generate a given problem when compared to another schema.
        /// </summary>
        /// <param name="problem">The change problem</param>
        public void ResolveProblem(ChangeProblem problem)
        {
            switch (problem.ProblemType)
            {
            case ChangeProblemType.DeletionNeeded:
                // Remove the problem for which deletion was needed
                TypeProperties.Remove(problem.TypeName);
                break;

            case ChangeProblemType.PropertyDropped:
            case ChangeProblemType.PropertyDroppedFromSummary:
                // Remove the property which was dropped
                TypeProperties[problem.TypeName].Remove(problem.PropertyName);
                break;

            // Problems not requiring data modification
            case ChangeProblemType.NotBinarySerializable:
            case ChangeProblemType.NullObjectValue:
                break;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Reverts part of the schema relevant to a problem to the state which when compared to its current
        /// state, regenerates the problem. The inverse of ResolveProblem.
        /// </summary>
        /// <param name="oldSchema">the old schema which generated the problem when compared to the current schema</param>
        /// <param name="problem">the problem it generated</param>
        public void ApplyProblem(ContentModelSchema oldSchema, ChangeProblem problem)
        {
            switch (problem.ProblemType)
            {
            case ChangeProblemType.DeletionNeeded:
                // copy the deleted type to the new schema
                TypeProperties.Add(problem.TypeName, oldSchema.TypeProperties[problem.TypeName]);
                break;

            case ChangeProblemType.PropertyDropped:
            case ChangeProblemType.PropertyDroppedFromSummary:
                // copy the dropped property to the new schema
                TypeProperties[problem.TypeName].Add(problem.PropertyName, oldSchema.TypeProperties[problem.TypeName][problem.PropertyName]);
                break;

            // Problems not requiring data modification
            case ChangeProblemType.NotBinarySerializable:
            case ChangeProblemType.NullObjectValue:
                break;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Updates this schema so it can no longer generate a given problem when compared to another schema.
        /// </summary>
        /// <param name="problem">The change problem</param>
        public void ResolveProblem(ChangeProblem problem)
        {
            string aqTypeName = problem.GetAssemblyQualifiedTypeName();

            switch (problem.ProblemType)
            {
            case ChangeProblemType.DeletionNeeded:
                // Remove the problem for which deletion was needed
                TypeProperties.Remove(aqTypeName);
                break;

            case ChangeProblemType.PropertyDropped:
            case ChangeProblemType.PropertyDroppedFromSummary:
                // Remove the property which was dropped
                TypeProperties[aqTypeName].Remove(problem.PropertyName);
                break;

            // Problems not requiring data modification
            case ChangeProblemType.NullObjectValue:
                break;
            }
        }