Exemple #1
0
        /// <summary>
        /// Gets the validation status.
        /// </summary>
        /// <returns></returns>
        public EntityStatus GetValidationStatus()
        {
            EntityStatus status = new EntityStatus(this.Id);

            try
            {
                var context = new ValidationContext(this, null, null);
                var vResult = new List <ValidationResult>();

                var isValid = Validator.TryValidateObject(this, context, vResult, true);
                if (!isValid)
                {
                    status.SetErrors(vResult);
                }
            }
            catch
            {
                status = new EntityStatus(this.Id);
            }

            return(status);
        }
Exemple #2
0
 public void AddEntityStatus(EntityStatus efStatus)
 {
     this.AddNotification(efStatus, efStatus.Id);
 }