Пример #1
0
 private void ValidateDuplicatedPropertieInInheritanceTree(ValidationContext context)
 {
     if (!this.IsValidationDisabled())
     {
         var validationResult = AssociationValidation.ValidateAssociationName(this);
         context.LogErrorIfAny(validationResult);
     }
 }
Пример #2
0
            protected override void OnValueChanged(PersistentTypeHasAssociations element, string oldValue, string newValue)
            {
                if (!element.Store.InUndoRedoOrRollback && !element.IsValidationDisabled())
                {
                    // Hard validation of the new name.
                    if (string.IsNullOrEmpty(newValue))
                    {
                        throw new ArgumentException("The Name is required and cannot be an empty string.", newValue);
                    }

                    var validationResult = AssociationValidation.ValidateAssociationName(element, newValue);

                    if (!validationResult.IsValid)
                    {
                        throw new ArgumentException(validationResult.ErrorMessage);
                    }

                    // Raise the NameChanged event for derived classes to act upon.
                    //element.OnNameChanged(EventArgs.Empty);
                }

                // Always call the base class method.
                base.OnValueChanged(element, oldValue, newValue);
            }