Ejemplo n.º 1
0
        protected override void Validate()
        {
            if (this.NeedValidation == true)
            {
                DESchemaPropertyValidatorContext context = DESchemaPropertyValidatorContext.Current;

                try
                {
                    context.Target    = this.Data;
                    context.Container = this._Container;

                    ValidationResults validationResult = new ValidationResults();

                    if (this.Data.Status == SchemaObjectStatus.Normal)
                    {
                        validationResult = this.Data.Validate();
                    }

                    //haoyk 2014-2-8
                    if (this.SaveMemberData && this.Members.Any())
                    {
                        this.Members.Where(p => p.Status == SchemaObjectStatus.Normal).ForEach(p =>
                        {
                            ValidationResults results = p.Validate();

                            if (results != null && results.Any())
                            {
                                results.ForEach(validationResult.AddResult);
                            }
                        });
                    }

                    ExceptionHelper.TrueThrow(validationResult.ResultCount > 0, validationResult.ToString());

                    CheckStatus();
                }
                finally
                {
                    DESchemaPropertyValidatorContext.Clear();
                }
            }
        }
Ejemplo n.º 2
0
        protected override void Validate()
        {
            if (this.NeedValidation == true)
            {
                DESchemaPropertyValidatorContext context = DESchemaPropertyValidatorContext.Current;

                try
                {
                    context.Target    = this.Data;
                    context.Container = this._Container;

                    ValidationResults validationResult = this.Data.Validate();

                    ExceptionHelper.TrueThrow(validationResult.ResultCount > 0, validationResult.ToString());

                    CheckStatus();
                }
                finally
                {
                    DESchemaPropertyValidatorContext.Clear();
                }
            }
        }