Our great sponsors
-
ASP.NET Core
ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
Entity Framework
EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
-
Open.ChannelExtensions
A set of extensions for optimizing/simplifying System.Threading.Channels usage.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
There's a better approach and it's types! Consider using Option from https://github.com/louthy/language-ext:
You probably know that ASP.NET Core has HttpContext. It contains RequestId which is added to every log record. But how is it acutally implemented? https://github.com/dotnet/aspnetcore/issues/31747 And what if I want to put some custom value to the context, is it possible? What if I have some extra logic associated with log context creation?
- Much ink has been spilled on HKT (https://github.com/dotnet/csharplang/issues/339).
Entity Framework is fundamentally a generic abstraction on top of sql, so if you love using Postgres specific features it's probably going to disappoint you. The Npgsql driver actual does make a lot of Postgres specific functionality available but I don't know if the specific operation you're looking for is included. If you like to write raw sql you probably want to use Dapper. It's very common to use both in the same code base.
You're looking for the System.Linq.Async nuget package that's part of the reactive extensions for .Net. It provides async versions of all the standard linq operators. Yes, IAsyncEnumerable can be incredibly useful. It's still relatively new (added about 2 years ago) so some libraries just haven't added support for yet and some are probably hesitant because using it requires a new C# language version. Many (most?) newer features in C# are syntactic sugar, i.e. I can turn on the newest version of C# and use all the fancy things, but then you can consume my library while still using an older language version. IAsyncEnumerable is one where (AFAIK) a library using that feature requires anyone using the library to also use a recent language version that supports it.
For streaming you should look into channels. The built in functionality is a bit too low level to be immediately useful, but if you use the ChannelExtensions library https://github.com/Open-NET-Libraries/Open.ChannelExtensions it's very easy to work with IAsynEnumerable and do things like batching, merging and transforming.