public override async Task <IEnumerable <T> > PerformQueryAsync(GetEntities <T> request, CancellationToken cancellationToken) { var dbSet = dbContextProvider.GetDBSet <T>(); var query = dbSet.GetSearchQuery(request.SearchTerm); return(await dbSet.QueryAsync(query, cancellationToken)); }
public override async Task <T> HandleAsync(UpdateEntityCommand <T> request, CancellationToken cancellationToken) { var dbSet = dbContextProvider.GetDBSet <T>(); request.Model.Id = request.Id; await dbSet.UpdateAsync(request.Model, cancellationToken); return(await dbSet.QueryByIdAsync(request.Id, cancellationToken)); }
public override async Task <Guid> HandleAsync(DeleteTenantEntityCommand <T> request, CancellationToken cancellationToken) { var dbSet = dbContextProvider.GetDBSet <T>(); var entity = await dbSet.QueryByIdAsync(request.Id, cancellationToken); await dbSet.DeleteAsync(entity, cancellationToken); return(request.Id); }
public async override Task <T> HandleAsync(CreateEntityCommand <T> request, CancellationToken cancellationToken) { var dbSet = dbContextProvider.GetDBSet <T>(); request.Model.Id = Guid.NewGuid(); await dbSet.InsertAsync(request.Model, cancellationToken); return(await dbSet.QueryByIdAsync(request.Model.Id, cancellationToken)); }
public override async Task <T> PerformQueryAsync(GetEntity <T> request, CancellationToken cancellationToken) { var dbSet = dbContextProvider.GetDBSet <T>(); return(await dbSet.QueryByIdAsync(request.Id, cancellationToken)); }