public async Task <ISuccessOrErrors> DeleteAsync(params object[] identifiers) { try { return(await this.deleteService.DeleteAsync(identifiers)); } catch (Exception e) { var throwOnError = DTORepositoryContainer.ThrowsOnDatabaseError; if (throwOnError) { throw; } var err = EntityFrameworkExceptionHandler.HandleException(e); return(err); } }
public async Task <ISuccessOrErrors <TDto> > GetAsync <TDto>(params object[] identifiers) where TDto : DtoBase <TContext, TEntity, TDto>, new() { try { return(await this.detailService.GetAsync <TDto>(identifiers)); } catch (Exception e) { var throwOnError = DTORepositoryContainer.ThrowsOnDatabaseError; if (throwOnError) { throw; } var err = EntityFrameworkExceptionHandler.HandleException(e); return(SuccessOrErrors <TDto> .ConvertNonResultStatus(err)); } }
public async Task <ISuccessOrErrors <TDto> > CreateOrUpdateAsync <TDto>(TDto dto) where TDto : DtoBase <TContext, TEntity, TDto>, new() { try { return(await this.createOrUpdateService.CreateOrUpdateAsync(dto)); } catch (Exception e) { var throwOnError = DTORepositoryContainer.ThrowsOnDatabaseError; if (throwOnError) { throw; } var err = EntityFrameworkExceptionHandler.HandleException(e); return(SuccessOrErrors <TDto> .ConvertNonResultStatus(err)); } }
public async Task <ISuccessOrErrors <IList <TDto> > > QueryAsync <TDto>(Expression <Func <TEntity, bool> > predicate = null) where TDto : DtoBase <TContext, TEntity, TDto>, new() { try { return(await listService.QueryAsync <TDto>(predicate)); } catch (Exception e) { var throwOnError = DTORepositoryContainer.ThrowsOnDatabaseError; if (throwOnError) { throw; } var err = EntityFrameworkExceptionHandler.HandleException(e); return(SuccessOrErrors <IList <TDto> > .ConvertNonResultStatus(err)); } }