question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ReadAsync method missing on type mappers

See original GitHub issue

Is there a reason why the Write method comes with an asynchronous version, but not the Read method? I’m certain that the underlying TextReader comes with async reading behaviour.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jehugaleahsacommented, Jun 27, 2021

So, there’s now a 4.16.0 out there. All I did was add new methods working with IAsyncEnumerable.

I changed a few of the convenience methods on the mapper to reuse the extension methods on the typed reader/writer classes under the hood, since I was essentially duplicating this code.

0reactions
silkfirecommented, Jun 26, 2021

Apologies, it was late and I realize I didn’t bother wording the issue properly, hopefully it should be clearer now 😃

I thought it was a bit unintuitive for the consumer to find an async Write method but not an equivalent async Read method.

I would suggest adding two methods, one to read the entire list asynchronously, perhaps with a helper ReadToList method (to avoid (await mapper.Read).ToList()), and one with IAsyncEnumerable support.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Read and ReadAync are producing totally different ...
The only reason it even has ReadAsync is because base stream class ( Stream ) has those methods. Even if you manage to...
Read more >
Generic type mapping and composites · Issue #2956
I've been getting lost in the different type mapping options lately - what is the best way to approach this? I have been...
Read more >
How do Object Relational Mappers (like Entity Framework ...
Here is the C# code if we manually retrieve the data and map it to a list of the Person class: public async...
Read more >
Stream.ReadAsync Method (System.IO)
Asynchronously reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read....
Read more >
Change Log | CsvHelper
Fixed constructor mapping issue where parameter has a type converter but would still try and use constructor mapping. Breaking Changes. Added string field...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found