protected override void HandleValidationErrors(IDictionary <string, Exception> errors, DataSourceOperation operation)
        {
            LinqDataSourceValidationException exception = new LinqDataSourceValidationException(String.Format(CultureInfo.InvariantCulture,
                                                                                                              AtlasWeb.LinqDataSourceView_ValidationFailed,
                                                                                                              EntityType, errors.Values.First().Message),
                                                                                                errors);

            bool exceptionHandled = false;

            switch (operation)
            {
            case DataSourceOperation.Delete:
                LinqDataSourceDeleteEventArgs deleteEventArgs = new LinqDataSourceDeleteEventArgs(exception);
                OnDeleting(deleteEventArgs);
                OnException(new DynamicValidatorEventArgs(exception, DynamicDataSourceOperation.Delete));
                exceptionHandled = deleteEventArgs.ExceptionHandled;
                break;

            case DataSourceOperation.Insert:
                LinqDataSourceInsertEventArgs insertEventArgs = new LinqDataSourceInsertEventArgs(exception);
                OnInserting(insertEventArgs);
                OnException(new DynamicValidatorEventArgs(exception, DynamicDataSourceOperation.Insert));
                exceptionHandled = insertEventArgs.ExceptionHandled;
                break;

            case DataSourceOperation.Update:
                // allow user to handle conversion or dlinq property validation exceptions.
                LinqDataSourceUpdateEventArgs updateEventArgs = new LinqDataSourceUpdateEventArgs(exception);
                OnUpdating(updateEventArgs);
                OnException(new DynamicValidatorEventArgs(exception, DynamicDataSourceOperation.Update));
                exceptionHandled = updateEventArgs.ExceptionHandled;
                break;
            }

            if (!exceptionHandled)
            {
                throw exception;
            }
        }
 public LinqDataSourceInsertEventArgs(LinqDataSourceValidationException exception) {
     _exception = exception;
 }
 public LinqDataSourceDeleteEventArgs(LinqDataSourceValidationException exception) {
     _exception = exception;
 }
 public LinqDataSourceInsertEventArgs(LinqDataSourceValidationException exception)
 {
     _exception = exception;
 }
Пример #5
0
 public LinqDataSourceUpdateEventArgs(LinqDataSourceValidationException exception)
 {
     Exception = exception;
 }
 public LinqDataSourceDeleteEventArgs(LinqDataSourceValidationException exception)
 {
     _exception = exception;
 }
		public LinqDataSourceUpdateEventArgs (LinqDataSourceValidationException exception)
		{
			Exception = exception;
		}
        protected override void HandleValidationErrors(IDictionary<string, Exception> errors, DataSourceOperation operation) {
            LinqDataSourceValidationException exception = new LinqDataSourceValidationException(String.Format(CultureInfo.InvariantCulture,
                AtlasWeb.LinqDataSourceView_ValidationFailed,
                EntityType, errors.Values.First().Message),
                errors);

            bool exceptionHandled = false;

            switch (operation) {
                case DataSourceOperation.Delete:
                    LinqDataSourceDeleteEventArgs deleteEventArgs = new LinqDataSourceDeleteEventArgs(exception);
                    OnDeleting(deleteEventArgs);
                    OnException(new DynamicValidatorEventArgs(exception, DynamicDataSourceOperation.Delete));
                    exceptionHandled = deleteEventArgs.ExceptionHandled;
                    break;

                case DataSourceOperation.Insert:
                    LinqDataSourceInsertEventArgs insertEventArgs = new LinqDataSourceInsertEventArgs(exception);
                    OnInserting(insertEventArgs);
                    OnException(new DynamicValidatorEventArgs(exception, DynamicDataSourceOperation.Insert));
                    exceptionHandled = insertEventArgs.ExceptionHandled;
                    break;
                case DataSourceOperation.Update:
                    // allow user to handle conversion or dlinq property validation exceptions.
                    LinqDataSourceUpdateEventArgs updateEventArgs = new LinqDataSourceUpdateEventArgs(exception);
                    OnUpdating(updateEventArgs);
                    OnException(new DynamicValidatorEventArgs(exception, DynamicDataSourceOperation.Update));
                    exceptionHandled = updateEventArgs.ExceptionHandled;
                    break;
            }

            if (!exceptionHandled) {
                throw exception;
            }
        }