C# Класс GenericServices.SaveChangesExtensions

This contains extention errors that change SaveChanges/SvaeChangesAsync into returning error messages rather than an exception on certain types of errors.
Показать файл Открыть проект

Открытые методы

Метод Описание
SaveChangesWithChecking ( this db ) : ISuccessOrErrors

This extension will undertake a SaveChanges but will catch any validation errors or specific SqlException specified in ServicesConfiguration.SqlErrorDict and return them as errors rather than throw an exception

SaveChangesWithCheckingAsync ( this db ) : Task

This extension will undertake a SaveChangesAsync but will catch any validation errors or specific SqlException specified in ServicesConfiguration.SqlErrorDict and return them as errors

Приватные методы

Метод Описание
TryDecodeDbUpdateException ( System.Data.Entity.Infrastructure.DbUpdateException ex ) : IEnumerable

This decodes the DbUpdateException. If there are any errors it can handle then it returns a list of errors. Otherwise it returns null which means rethrow the error as it has not been handled

Описание методов

SaveChangesWithChecking() публичный статический Метод

This extension will undertake a SaveChanges but will catch any validation errors or specific SqlException specified in ServicesConfiguration.SqlErrorDict and return them as errors rather than throw an exception
public static SaveChangesWithChecking ( this db ) : ISuccessOrErrors
db this
Результат ISuccessOrErrors

SaveChangesWithCheckingAsync() публичный статический Метод

This extension will undertake a SaveChangesAsync but will catch any validation errors or specific SqlException specified in ServicesConfiguration.SqlErrorDict and return them as errors
public static SaveChangesWithCheckingAsync ( this db ) : Task
db this
Результат Task