NikolayIT / NikolayIT/ASP.NET-Core-Template

How to apply the .ToListAsync();?

Open
#71 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.2k
Forks
174
Avg merge
7m
Merged PRs (30d)
1

Description

In asynchronous programming there is a very useful async method: ToListAsync();
However, it comes from EntityFramework. So basically if we use the template here and call .All(); method in the Service and after that call .ToListAsync() in the service - then we will create a dependency between the Service and EF.

Perhaps I should add a wrapper method for this in the generic repository like I have done it here:

Or maybe there is a better way? Let me know your thoughts!

https://github.com/MiBuena/ListGeneratorAsync/blob/19093c731337d7b1b2a91963e047873142f4d9de/ListGeneration.Data/Repositories/EfRepository.cs#L30

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked EfRepository.cs example at line 30, then trace how the template's service calls All() and where ToListAsync() would be introduced. Resolve which repository or service boundary should own the Entity Framework dependency; done requires a clear, agreed design for asynchronous list retrieval.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, database
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.