Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
 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));
     }
 }
Exemplo n.º 3
0
 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));
     }
 }
Exemplo n.º 4
0
 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));
     }
 }