Posted: November 27, 2018 at 1:03 PM Quote #216705
I am seeing your IRepository implementations and I would like to add a point that all requests that are coming from the browser are asynchronous requests but when you read from the database that is a synchronous call. When the application doesn't have too many users connected is fine and changing that to async will no have any difference, but when it goes to a lot of users connected and consuming database request, that will have an impact on the performance.

Current Implementation:

        public virtual TEntity GetById(object id)
            return Entities.Find(id);


public virtual async Task<TEntity> GetByIdAsync(object id)
    return await Entities.FindAsync(id);

and call it everywhere you have it with await GetByAsync(2);

This will introduce a lot of chances on the different layers but should not change any logic, just the syntax of the methods that use the Async methods inside.

Let me know what you think.
This post/answer is useful
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)