コード例 #1
0
            /// <summary>
            /// ChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.SetConstraint)
            /// </summary>
            private static void SetConstraintChangedRule(ElementPropertyChangedEventArgs e)
            {
                Guid propertyId = e.DomainProperty.Id;

                if (propertyId == SetConstraint.ModalityDomainPropertyId)
                {
                    SetConstraint constraint = (SetConstraint)e.ModelElement;
                    if (IsRelevantConstraint(constraint.Constraint))
                    {
                        foreach (Role role in constraint.RoleCollection)
                        {
                            // Note that constraint.FactTypeCollection does not resolve the
                            // BinarizedFactType. Notifying twice on one FactType is harmless
                            // due to delayed validation.
                            FactTypeConstraintPatternChanged(role.BinarizedFactType);
                        }
                    }
                }
                else if (propertyId == SetConstraint.NameDomainPropertyId)
                {
                    UniquenessConstraint uniquenessConstraint;
                    Uniqueness           uniqueness;
                    if (null != (uniquenessConstraint = e.ModelElement as UniquenessConstraint) &&
                        null != (uniqueness = UniquenessIsForUniquenessConstraint.GetUniqueness(uniquenessConstraint)))
                    {
                        uniqueness.Name = uniquenessConstraint.Name;
                    }
                }
            }
コード例 #2
0
        private void RedrawAssociatedPels(bool includeFacts)
        {
            IConstraint constraint = AssociatedConstraint;

            if (null != constraint)
            {
                Diagram diagram = this.Diagram;
                switch (constraint.ConstraintStorageStyle)
                {
                case ConstraintStorageStyle.SetConstraint:
                    SetConstraint scec            = constraint as SetConstraint;
                    bool          individualRoles = 0 != (constraint.RoleSequenceStyles & RoleSequenceStyles.ConnectIndividualRoles);
                    foreach (FactSetConstraint factConstraint in DomainRoleInfo.GetElementLinks <FactSetConstraint>(scec, FactSetConstraint.SetConstraintDomainRoleId))
                    {
                        // Redraw the line
                        if (individualRoles)
                        {
                            foreach (ConstraintRoleSequenceHasRole constraintRole in factConstraint.ConstrainedRoleCollection)
                            {
                                RedrawPelsOnDiagram(constraintRole, diagram);
                            }
                        }
                        else
                        {
                            RedrawPelsOnDiagram(factConstraint, diagram);
                        }
                        if (includeFacts)
                        {
                            // Redraw the fact type
                            RedrawPelsOnDiagram(factConstraint.FactType, diagram);
                        }
                    }
                    break;

                case ConstraintStorageStyle.SetComparisonConstraint:
                    SetComparisonConstraint mcec = constraint as SetComparisonConstraint;
                    foreach (FactSetComparisonConstraint factConstraint in DomainRoleInfo.GetElementLinks <FactSetComparisonConstraint>(mcec, FactSetComparisonConstraint.SetComparisonConstraintDomainRoleId))
                    {
                        // Redraw the line
                        RedrawPelsOnDiagram(factConstraint, diagram);
                        if (includeFacts)
                        {
                            // Redraw the fact type
                            RedrawPelsOnDiagram(factConstraint.FactType, diagram);
                        }
                    }
                    break;
                }
            }
            Invalidate(true);
        }