C# 클래스 GenericServices.SaveChangesExtensions

This contains extention errors that change SaveChanges/SvaeChangesAsync into returning error messages rather than an exception on certain types of errors.
파일 보기 프로젝트 열기: JonPSmith/GenericServices

공개 메소드들

메소드 설명
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