1

Lets assume I have a repository with such method

public async Task<T> FindAsync(object id)
{
       var entity = await DbSet.FindAsync(id).ConfigureAwait(false);

       return entity;
}

Should I actualy await FindAsync or just return Task and then allow it to be awaited on Controller level, so it would look like this:

public Task<T> Find(object id)
{
       return DbSet.FindAsync(id);
}

Overall should I await on every level Repository, Service Controller, or is it better to return task to the highest level and await it only there?

0 Answers0