Пример #1
0
        public virtual async Task <bool> TryCompleteAsync()
        {
            try
            {
                ValidationState = await _context.ValidatableSaveChangesAsync();
            }
            catch (Exception e)
            {
                ValidationState = EntityValidationState.Error(null, e.ToString());
                return(false);
            }

            return(ValidationState.IsValid);
        }
Пример #2
0
        protected EntityValidationState TrySaveChanges()
        {
            try
            {
                SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(EntityValidationState.Error(er => e.InnerException, e.ToString()));
            }

            return(EntityValidationState.Valid);
        }