From: <mcu...@us...> - 2007-08-20 21:47:17
|
Revision: 1090 http://orm.svn.sourceforge.net/orm/?rev=1090&view=rev Author: mcurland Date: 2007-08-20 14:47:19 -0700 (Mon, 20 Aug 2007) Log Message: ----------- Added additional rules for propagating ORM model changes to the abstraction model. Mandatory changes and uniqueness constraint deletion cases that do not modify absorption are handled incrementally. Preferred identifier changes fully regenerate. refs #327 Modified Paths: -------------- trunk/Oial/ORMOialBridge/ModificationTracker.cs trunk/Oial/ORMOialBridge/ORMElementGateway.cs trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.cs trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.xml trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs Modified: trunk/Oial/ORMOialBridge/ModificationTracker.cs =================================================================== --- trunk/Oial/ORMOialBridge/ModificationTracker.cs 2007-08-20 21:45:28 UTC (rev 1089) +++ trunk/Oial/ORMOialBridge/ModificationTracker.cs 2007-08-20 21:47:19 UTC (rev 1090) @@ -114,6 +114,59 @@ } } } + /// <summary> + /// RolePlayerChangeRule: typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier) + /// Changing the preferred identifier for an <see cref="ObjectType"/> is considered to + /// be a significant change until we support full incremental tracking. + /// </summary> + private static void PreferredIdentifierRolePlayerChangedRule(RolePlayerChangedEventArgs e) + { + // UNDONE: Incremental changes, propagate changes to Uniqueness.IsPreferred property + EntityTypeHasPreferredIdentifier link = (EntityTypeHasPreferredIdentifier)e.ElementLink; + if (e.DomainRole.Id == EntityTypeHasPreferredIdentifier.PreferredIdentifierForDomainRoleId) + { + SignificantObjectTypeChange((ObjectType)e.OldRolePlayer); + } + SignificantObjectTypeChange(link.PreferredIdentifierFor); + } + /// <summary> + /// DeleteRule: typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier) + /// If an <see cref="ObjectType"/> is alive after gateway processing when its preferred identifier + /// is deleted then it needs to be reprocessed. + /// </summary> + private static void PreferredIdentifierDeletedRule(ElementDeletedEventArgs e) + { + // UNDONE: Incremental If this gets passed the gateway and is not excluded, + // then it changed from an EntityType to a ValueType + ObjectType objectType = ((EntityTypeHasPreferredIdentifier)e.ModelElement).PreferredIdentifierFor; + if (!objectType.IsDeleted) + { + SignificantObjectTypeChange(objectType); + } + } + /// <summary> + /// RolePlayerChangeRule: typeof(Neumont.Tools.ORM.ObjectModel.ObjectTypePlaysRole) + /// Revalidate the model when the <see cref="ObjectType">role player</see> of a <see cref="Role"/> + /// is changed. + /// </summary> + private static void RolePlayerRolePlayerChangedRule(RolePlayerChangedEventArgs e) + { + // UNDONE: Incremental changes will not be as severe here. Note that adding + // and deleting role players already triggers the correct actions in the + // gateway rules. However, a change where none of the parties are excluded + // simply needs to regenerate for now. + ObjectTypePlaysRole link = (ObjectTypePlaysRole)e.ElementLink; + if (e.DomainRole.Id == ObjectTypePlaysRole.PlayedRoleDomainRoleId) + { + SignificantFactTypeChange(((Role)e.OldRolePlayer).FactType); + } + else + { + SignificantObjectTypeChange((ObjectType)e.OldRolePlayer); + } + SignificantObjectTypeChange(link.RolePlayer); + SignificantFactTypeChange(link.PlayedRole.FactType); + } #endregion // ORM modification rule methods #region Bridge deletion rule methods /// <summary> @@ -154,6 +207,20 @@ AddTransactedModelElement(conceptType, ModelElementModification.AbstractionElementDetached); } } + /// <summary> + /// DeleteRule: typeof(UniquenessIsForUniquenessConstraint) + /// </summary> + private static void UniquenessBridgeDetachedRule(ElementDeletedEventArgs e) + { + Uniqueness uniqueness = ((UniquenessIsForUniquenessConstraint)e.ModelElement).Uniqueness; + if (!uniqueness.IsDeleted) + { + // We don't want to rebuild the model for this case. Any significant + // change that affects the absorption pattern will remove it, and + // there are no cases where we need to keep it. Just propagate. + uniqueness.Delete(); + } + } #endregion // Bridge deletion rule methods #region General validation helper methods private static bool IsRelevantConstraint(IConstraint constraint) @@ -198,7 +265,10 @@ MappingMandatoryPattern endMandatoryPattern = mapToRole.MandatoryPattern; if (endMandatoryPattern != startMandatoryPattern) { - // UNDONE: Propagate IsMandatory changes directly to the model + foreach (ConceptTypeChild child in ConceptTypeChildHasPathFactType.GetConceptTypeChild(factType)) + { + ValidateMandatory(child, startMandatoryPattern, endMandatoryPattern); + } } } else @@ -209,6 +279,88 @@ } } } + /// <summary> + /// The <see cref="ConceptTypeChild.IsMandatory">IsMandatory</see> setting may + /// have change, revalidate if necessary. + /// </summary> + /// <param name="child">The <see cref="ConceptTypeChild"/> element to validate</param> + /// <param name="oldMandatory">The old mandatory pattern for any <see cref="FactType"/> in the path.</param> + /// <param name="newMandatory">The new mandatory pattern for any <see cref="FactType"/> in the path.</param> + private static void ValidateMandatory(ConceptTypeChild child, MappingMandatoryPattern oldMandatory, MappingMandatoryPattern newMandatory) + { + // We pre filter this and don't both to notify unless a change is possible + bool mightHaveChanged = false; + if (child.IsMandatory) + { + switch (oldMandatory) + { + case MappingMandatoryPattern.BothRolesMandatory: + case MappingMandatoryPattern.TowardsRoleMandatory: + switch (newMandatory) + { + case MappingMandatoryPattern.OppositeRoleMandatory: + case MappingMandatoryPattern.NotMandatory: + mightHaveChanged = true; + break; + } + break; + } + } + else + { + switch (oldMandatory) + { + case MappingMandatoryPattern.NotMandatory: + case MappingMandatoryPattern.OppositeRoleMandatory: + switch (newMandatory) + { + case MappingMandatoryPattern.BothRolesMandatory: + case MappingMandatoryPattern.TowardsRoleMandatory: + mightHaveChanged = true; + break; + } + break; + } + } + if (mightHaveChanged) + { + FrameworkDomainModel.DelayValidateElement(child, ValidateMandatoryDelayed); + } + } + [DelayValidatePriority(ValidationPriority.ValidateMandatory)] + private static void ValidateMandatoryDelayed(ModelElement element) + { + if (!element.IsDeleted) + { + ConceptTypeChild child = (ConceptTypeChild)element; + bool newMandatory = true; + foreach (FactType factType in ConceptTypeChildHasPathFactType.GetPathFactTypeCollection(child)) + { + FactTypeMapsTowardsRole towardsRoleLink = FactTypeMapsTowardsRole.GetLinkToTowardsRole(factType); + if (null == towardsRoleLink) + { + newMandatory = false; + break; + } + else + { + switch (towardsRoleLink.MandatoryPattern) + { + case MappingMandatoryPattern.None: + case MappingMandatoryPattern.NotMandatory: + case MappingMandatoryPattern.OppositeRoleMandatory: + newMandatory = false; + break; + } + if (!newMandatory) + { + break; + } + } + } + child.IsMandatory = newMandatory; + } + } private static void SignificantFactTypeChange(FactType factType) { if (factType != null && Modified: trunk/Oial/ORMOialBridge/ORMElementGateway.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMElementGateway.cs 2007-08-20 21:45:28 UTC (rev 1089) +++ trunk/Oial/ORMOialBridge/ORMElementGateway.cs 2007-08-20 21:47:19 UTC (rev 1090) @@ -31,20 +31,6 @@ /// </summary> private static partial class ORMElementGateway { - #region ValidationPriority enum - /// <summary> - /// DelayValidate ordering constants - /// </summary> - private static class ValidationPriority - { - public const int NewObjectType = -100; - public const int ReconsiderObjectType = -90; - public const int NewFactType = -80; - public const int ReconsiderFactType = -70; - public const int RemoveExcludedBridgeRelationships = -60; - public const int AddElement = -50; - } - #endregion // ValidationPriority enum #region Public methods /// <summary> /// Returns <see langword="true"/> if an element is currently excluded from @@ -168,7 +154,7 @@ } #endregion // ShouldConsider* methods, determine if an element should be filtered #region FilterNew* methods, determine filtering for newly created elements - [DelayValidatePriority(ValidationPriority.NewFactType)] + [DelayValidatePriority(ValidationPriority.GatewayNewFactType)] private static void FilterNewFactType(ModelElement element) { ModelHasFactType link = element as ModelHasFactType; @@ -182,7 +168,7 @@ ExcludeFactType(factType); } } - [DelayValidatePriority(ValidationPriority.NewObjectType)] + [DelayValidatePriority(ValidationPriority.GatewayNewObjectType)] private static void FilterNewObjectType(ModelElement element) { ModelHasObjectType link = element as ModelHasObjectType; @@ -219,7 +205,7 @@ } } } - [DelayValidatePriority(ValidationPriority.ReconsiderFactType)] + [DelayValidatePriority(ValidationPriority.GatewayReconsiderFactType)] private static void FilterModifiedFactTypeDelayed(ModelElement element) { if (!element.IsDeleted) @@ -260,7 +246,7 @@ FrameworkDomainModel.DelayValidateElement(objectType, FilterModifiedObjectTypeDelayed); } } - [DelayValidatePriority(ValidationPriority.ReconsiderObjectType)] + [DelayValidatePriority(ValidationPriority.GatewayReconsiderObjectType)] private static void FilterModifiedObjectTypeDelayed(ModelElement element) { if (!element.IsDeleted) @@ -374,7 +360,7 @@ /// Delay validation callback used when the state of a <see cref="FactType"/> /// has changed such that it may or may not be included in the abstraction model. /// </summary> - [DelayValidatePriority(ValidationPriority.AddElement)] + [DelayValidatePriority(ValidationPriority.GatewayAddElement)] private static void AddFactTypeDelayed(ModelElement element) { if (!element.IsDeleted) @@ -404,7 +390,7 @@ /// Delay validation callback used when the state of a <see cref="ObjectType"/> /// has changed such that it may or may not be included in the abstraction model. /// </summary> - [DelayValidatePriority(ValidationPriority.AddElement)] + [DelayValidatePriority(ValidationPriority.GatewayAddElement)] private static void AddObjectTypeDelayed(ModelElement element) { if (!element.IsDeleted) @@ -429,7 +415,7 @@ { FrameworkDomainModel.DelayValidateElement(e.ModelElement, ExclusionAdded); } - [DelayValidatePriority(ValidationPriority.RemoveExcludedBridgeRelationships)] + [DelayValidatePriority(ValidationPriority.GatewayRemoveExcludedBridgeRelationships)] private static void ExclusionAdded(ModelElement element) { ExcludedORMModelElement link = (ExcludedORMModelElement)element; Modified: trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.cs 2007-08-20 21:45:28 UTC (rev 1089) +++ trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.cs 2007-08-20 21:47:19 UTC (rev 1090) @@ -51,7 +51,11 @@ typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("ConstraintRoleDeletedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("ObjectTypeChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("ORMModelChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), - typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("SetConstraintChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic)}; + typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("PreferredIdentifierDeletedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), + typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("PreferredIdentifierRolePlayerChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), + typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("RolePlayerRolePlayerChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), + typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("SetConstraintChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), + typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("UniquenessBridgeDetachedRuleClass", BindingFlags.Public | BindingFlags.NonPublic)}; ORMToORMAbstractionBridgeDomainModel.myCustomDomainModelTypes = retVal; System.Diagnostics.Debug.Assert(Array.IndexOf<Type>(retVal, null) < 0, "One or more rule types failed to resolve. The file and/or package will fail to load."); } @@ -85,7 +89,7 @@ { Microsoft.VisualStudio.Modeling.RuleManager ruleManager = store.RuleManager; Type[] disabledRuleTypes = ORMToORMAbstractionBridgeDomainModel.CustomDomainModelTypes; - for (int i = 0; i < 18; ++i) + for (int i = 0; i < 22; ++i) { ruleManager.EnableRule(disabledRuleTypes[i]); } @@ -572,6 +576,84 @@ Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.ORMModelChangedRule"); } } + [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier))] + private sealed class PreferredIdentifierDeletedRuleClass : Microsoft.VisualStudio.Modeling.DeleteRule + { + [System.Diagnostics.DebuggerStepThrough()] + public PreferredIdentifierDeletedRuleClass() + { + base.IsEnabled = false; + } + /// <summary> + /// Provide the following method in class: + /// Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker + /// /// <summary> + /// /// DeleteRule: typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier) + /// /// </summary> + /// private static void PreferredIdentifierDeletedRule(ElementDeletedEventArgs e) + /// { + /// } + /// </summary> + [System.Diagnostics.DebuggerStepThrough()] + public override void ElementDeleted(Microsoft.VisualStudio.Modeling.ElementDeletedEventArgs e) + { + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.PreferredIdentifierDeletedRule"); + ModificationTracker.PreferredIdentifierDeletedRule(e); + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.PreferredIdentifierDeletedRule"); + } + } + [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier))] + private sealed class PreferredIdentifierRolePlayerChangedRuleClass : Microsoft.VisualStudio.Modeling.RolePlayerChangeRule + { + [System.Diagnostics.DebuggerStepThrough()] + public PreferredIdentifierRolePlayerChangedRuleClass() + { + base.IsEnabled = false; + } + /// <summary> + /// Provide the following method in class: + /// Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker + /// /// <summary> + /// /// RolePlayerChangeRule: typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier) + /// /// </summary> + /// private static void PreferredIdentifierRolePlayerChangedRule(RolePlayerChangedEventArgs e) + /// { + /// } + /// </summary> + [System.Diagnostics.DebuggerStepThrough()] + public override void RolePlayerChanged(Microsoft.VisualStudio.Modeling.RolePlayerChangedEventArgs e) + { + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleStart(e.ElementLink.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.PreferredIdentifierRolePlayerChangedRule"); + ModificationTracker.PreferredIdentifierRolePlayerChangedRule(e); + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ElementLink.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.PreferredIdentifierRolePlayerChangedRule"); + } + } + [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORM.ObjectModel.ObjectTypePlaysRole))] + private sealed class RolePlayerRolePlayerChangedRuleClass : Microsoft.VisualStudio.Modeling.RolePlayerChangeRule + { + [System.Diagnostics.DebuggerStepThrough()] + public RolePlayerRolePlayerChangedRuleClass() + { + base.IsEnabled = false; + } + /// <summary> + /// Provide the following method in class: + /// Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker + /// /// <summary> + /// /// RolePlayerChangeRule: typeof(Neumont.Tools.ORM.ObjectModel.ObjectTypePlaysRole) + /// /// </summary> + /// private static void RolePlayerRolePlayerChangedRule(RolePlayerChangedEventArgs e) + /// { + /// } + /// </summary> + [System.Diagnostics.DebuggerStepThrough()] + public override void RolePlayerChanged(Microsoft.VisualStudio.Modeling.RolePlayerChangedEventArgs e) + { + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleStart(e.ElementLink.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.RolePlayerRolePlayerChangedRule"); + ModificationTracker.RolePlayerRolePlayerChangedRule(e); + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ElementLink.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.RolePlayerRolePlayerChangedRule"); + } + } [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORM.ObjectModel.SetConstraint))] private sealed class SetConstraintChangedRuleClass : Microsoft.VisualStudio.Modeling.ChangeRule { @@ -598,6 +680,32 @@ Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.SetConstraintChangedRule"); } } + [Microsoft.VisualStudio.Modeling.RuleOn(typeof(UniquenessIsForUniquenessConstraint))] + private sealed class UniquenessBridgeDetachedRuleClass : Microsoft.VisualStudio.Modeling.DeleteRule + { + [System.Diagnostics.DebuggerStepThrough()] + public UniquenessBridgeDetachedRuleClass() + { + base.IsEnabled = false; + } + /// <summary> + /// Provide the following method in class: + /// Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker + /// /// <summary> + /// /// DeleteRule: typeof(UniquenessIsForUniquenessConstraint) + /// /// </summary> + /// private static void UniquenessBridgeDetachedRule(ElementDeletedEventArgs e) + /// { + /// } + /// </summary> + [System.Diagnostics.DebuggerStepThrough()] + public override void ElementDeleted(Microsoft.VisualStudio.Modeling.ElementDeletedEventArgs e) + { + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.UniquenessBridgeDetachedRule"); + ModificationTracker.UniquenessBridgeDetachedRule(e); + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.UniquenessBridgeDetachedRule"); + } + } } } #endregion // Rule classes for AbstractionModelIsForORMModel.ModificationTracker Modified: trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.xml =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.xml 2007-08-20 21:45:28 UTC (rev 1089) +++ trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.xml 2007-08-20 21:47:19 UTC (rev 1090) @@ -80,9 +80,21 @@ <arg:ChangeRule methodName="ORMModelChangedRule"> <arg:RuleOn targetType="ORMModel" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> </arg:ChangeRule> + <arg:DeleteRule methodName="PreferredIdentifierDeletedRule"> + <arg:RuleOn targetType="EntityTypeHasPreferredIdentifier" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> + </arg:DeleteRule> + <arg:RolePlayerChangeRule methodName="PreferredIdentifierRolePlayerChangedRule"> + <arg:RuleOn targetType="EntityTypeHasPreferredIdentifier" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> + </arg:RolePlayerChangeRule> + <arg:RolePlayerChangeRule methodName="RolePlayerRolePlayerChangedRule"> + <arg:RuleOn targetType="ObjectTypePlaysRole" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> + </arg:RolePlayerChangeRule> <arg:ChangeRule methodName="SetConstraintChangedRule"> <arg:RuleOn targetType="SetConstraint" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> </arg:ChangeRule> + <arg:DeleteRule methodName="UniquenessBridgeDetachedRule"> + <arg:RuleOn targetType="UniquenessIsForUniquenessConstraint"/> + </arg:DeleteRule> </arg:RuleContainer> </arg:Model> </arg:Rules> \ No newline at end of file Modified: trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs =================================================================== --- trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-20 21:45:28 UTC (rev 1089) +++ trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-20 21:47:19 UTC (rev 1090) @@ -15,6 +15,53 @@ { public partial class AbstractionModelIsForORMModel { + #region ValidationPriority enum + /// <summary> + /// DelayValidate ordering constants. Handles non-zero values for + /// validation methods in this class and nested classes. + /// </summary> + private static class ValidationPriority + { + /// <summary> + /// A new <see cref="ObjectType"/> has been added to the ORM model, establish + /// gateway exclusion relationships. + /// </summary> + public const int GatewayNewObjectType = -100; + /// <summary> + /// An <see cref="ObjectType"/> has been modified in the ORM model, establish + /// gateway exclusion relationships. + /// </summary> + public const int GatewayReconsiderObjectType = -90; + /// <summary> + /// A <see cref="FactType"/> has been modified in the ORM model, establish + /// gateway exclusion relationships. + /// </summary> + public const int GatewayNewFactType = -80; + /// <summary> + /// A <see cref="FactType"/> has been modified in the ORM model, establish + /// gateway exclusion relationships. + /// </summary> + public const int GatewayReconsiderFactType = -70; + /// <summary> + /// Gateway exclusion relationships have been added, remove other existing + /// bridge relationships + /// </summary> + public const int GatewayRemoveExcludedBridgeRelationships = -60; + /// <summary> + /// A new element has been added and passed gateway filtering + /// </summary> + public const int GatewayAddElement = -50; + /// <summary> + /// Validate the model. Current rebuilds the entire model. + /// </summary> + public const int ValidateModel = 100; + /// <summary> + /// Reset mandatory properties. This is done after ValidateModel + /// so that we don't waste time + /// </summary> + public const int ValidateMandatory = 110; + } + #endregion // ValidationPriority enum #region Element tracking transaction support #region ModelElementModification enum /// <summary> @@ -77,7 +124,7 @@ /// Delays the validate model. /// </summary> /// <param name="element">The element.</param> - [DelayValidatePriority(100)] + [DelayValidatePriority(ValidationPriority.ValidateModel)] private static void DelayValidateModel(ModelElement element) { Dictionary<object, object> contextDictionary = element.Store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |