r/csharp • • 1h ago

Showcase C#'s rules for top-level statements turned out to be a great fit for a reactive notebook, so I built one

5 Upvotes

been working on something called Reverb, it's basically a notebook for C# where changing one cell automatically re-runs only the cells that depend on it.

the cool thing is that C# already handles a lot of the hard parts for us.

it's just a normal .cs file with // %% comments separating cells, and you run it with dotnet run.

one thing i found interesting is how top-level statements in C# make dependency ordering pretty straightforward. you can't declare the same variable twice, and you can't use a variable before declaring it. so the order of cells in the file is already a valid execution order. no need to build a separate dependency scheduler like reactive Python notebooks such as marimo have to.

there are still a few things that need to be checked though:

  • a cell can't assign to a variable declared in another cell.

  • anonymous types can't cross cell boundaries because the generated code needs to reference the type.

  • local functions were an interesting one. turns out C# lets you call a local function before it's declared, which breaks the whole file-order-is-dependency-order assumption. had to add a rule for that too.

for dependency tracking, i'm using Roslyn's SemanticModel.AnalyzeDataFlow on each cell's statements. it tells us which variables are coming from other cells and which ones are declared by the current cell.

each cell then gets compiled into a static method. inputs are read from a shared value store and outputs are written back to it.

also added #line directives so compiler errors and stack traces actually point to the right lines in the original file.

here's a small example:

// %% id=threshold
var threshold = Ui.Slider("Minimum order", min: 0, max: 1000, value: 400);

// %% id=summary
var big = orders.Where(o => o.Total >= threshold.Value).ToList();
big.Count.Dump("Orders above threshold");

move the slider and only the summary cell runs again.

install it:

dotnet tool install -g Reverb.Notebooks

it's open source (MIT):
https://github.com/muneeb-devp/reverb

would love to hear about any weird C# data flow edge cases i might have missed. especially things that could break the dependency tracking. always possible i've overlooked something :)


r/csharp • • 2h ago

Showcase I built a PDF engine in pure C#. Version 1.9.3 reads EPUB and DjVu too.

29 Upvotes

I've been building KillerPdf.Engine, a PDF 2.0 engine written entirely in C# on .NET 10, as the core of my free PDF editor. It has no native PDF library underneath, so everything from the lexer to the rasterizer is managed code.

Creating a document looks like this:

using KillerPdf.Engine.Authoring;

byte[] pdf = new PdfDocumentBuilder()
    .SetMetadata(new PdfDocumentMetadata
    {
        Title = "Hello from The KillerPDF.Engine",
        Author = "Example application",
        Language = "en-US"
    })
    .AddBlankPage(612, 792)
    .Build();

And this pulls words with their positions off a page:

using KillerPdf.Engine.Documents;

PdfDocument document = PdfDocument.Open(File.ReadAllBytes("input.pdf"), string.Empty);
var reader = new PdfPageContentReader(document);
PdfPageContent page = reader.Read(0);
foreach (PdfExtractedWord word in page.Words)
    Console.WriteLine($"{word.Text}: {word.BoundingBox}");

Beyond that, it renders, edits, redacts, fills and flattens forms, signs, encrypts, runs OCR, exports to Office, HTML, Markdown and JSON, and does ICC color management with printer proofing. As of 1.9.3, it also reads EPUB and DjVu natively and converts them to PDF.

A few things that surprised me building it

  • The spec is the easy part. Real PDFs break it constantly: cross-reference tables that point at the wrong byte, trailers with the keyword mangled, numbers like 1-.5 inside content streams. Most of the engine's code is recovery, not parsing. A strict reader that rejects all of it would open far fewer of the files people actually have. The 47,024-file test corpus exists because no amount of reading the spec tells you what's actually out there.

  • Lazy beats fast. The big performance wins came from doing less work, not from optimizing what was already there. That meant reading the file fewer times on open, building each page only when it's drawn, and rendering thumbnails only for the pages on screen. In the desktop app, a 20,000-page PDF went from about 20 seconds to its first page down to about 9, and from 1.9 GB peak memory to about 700 MB.

  • Writing a PDF is harder than reading one. Reading only has to survive a file once. Writing has to leave signatures, encryption, form values and everyone else's content intact, often as an incremental update appended to the original. Size matters too. Early on, every added text note embedded its own copy of the font. Sharing one subset per font across the document took a 3,000-page test from a 103 MB save in 32 seconds to an 11 MB save in about 7.5.

It's 514 files, about 167,000 lines and 13,052 tests, and it's licensed GPL-3.0.

dotnet add package KillerPdf.Engine

https://github.com/SteveTheKiller/KillerPDF/tree/main/engine


r/csharp • • 4h ago

Help Need design help

2 Upvotes

I have library that support tailwind-like attributes, but i have a problem.

for example i have this code:

<Border size-20 bg-red-300 ${hover}:bg-red-700/>

works great. When you hover over the box its background changes, also ${hover} is markupExtension not special syntax.

But if you write this

<Button Content="Hi" bg-red-300 ${hover}:bg-red-700/>

it wont work because fluent sets the bg directly on the ContentPresenter, not on the button:

<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
      <Setter Property="Background" Value="{DynamicResource ButtonBackgroundPointerOver}" />
</Style>

That's why i need new syntax to work with it, but i dont know how to make it right

First i thought about adding a Target property, for example

<Button Content="Hi" bg-red-300 ${hover Target=/template/ ContentPresenter}:bg-red-700/>

or i thought about allowing multiple markup extensions prefixes:

<Button Content="Hi" bg-red-300 ${hover}:{template ContentPresenter}:bg-red-700/>

because it would be cool if, in the future, you could write something like this:

<Border bg-red-300 ${hover}:bg-red-500 ${hover}:${Bindint MyBoolProperty}:bg-red-700 />

but it looks pretty verbose.

Another opinion is something similar to tailwind's arbitary variants using []:

 <Button Content="Hi" bg-red-300  ${hover}:[& /template/ ContentPresenter]:bg-red-700 />

Or maybe a shorter syntax specificaly for template parts:

<Button Content="Hi" bg-red-300 ${hover}:part-[PART_ContentPresenter]:bg-red-700 />

I like the idea of combining multiple condition, but i also want to keep the syntax simple.

What do you think? Which option looks better, or maybe there's a cleaner way to do this.


r/csharp • • 4h ago

I made a free, open-source app that counts every chest you open in Fortnite (reads your replays)

1 Upvotes

I wanted to know how many chests I actually open, so I built ChestCounter: a small Windows app that reads the replays Fortnite already saves and counts the chests you opened.

What it shows

  • Total chests since any date you pick (or all time), today, average per match, best match and best day

  • A "rhythm" of each match: a gold mark at the minute you opened each chest

  • Chests per mode, and your team's chests (you + teammates)

  • Optional extras you can count too: ammo boxes, loot cannons, food boxes…

  • A small always-on-top window with the last match and your total (click-through when locked)

  • Can start automatically with Fortnite

  • Counts the matches you already played (it reads the replays already on your PC) and keeps the history after Fortnite deletes old replays

  • English, Português, Español, Français, Deutsch

How: turn on Settings → Game → Replays → Record Replays, run the exe. It only reads .replay files — it never touches the game or its memory, so no anti-cheat issues.

Limits: replays can only be read after the match ends (so it updates at the end of each match, not live), and a replay only sees what happens near you, so teammates far away can be under-counted.

Source code (MIT) and download: https://github.com/Waze7123/ChestCounter

Feedback and pull requests welcome!


r/csharp • • 5h ago

NetWasm.UI v0.10: NuGet/.NET Standard packages, prerendering, [Reactive] properties and a smaller runtime for C# WebAssembly UI

Thumbnail
reddit.com
3 Upvotes

r/csharp • • 6h ago

Tool RunSignal: get alerted when a Hangfire, Quartz.NET or BackgroundService job silently stops running

0 Upvotes

RunSignal alerts you when a background job is missed, hangs, fails or processes nothing. You declare what each job should do. RunSignal records runs as OpenTelemetry metrics and turns those expectations into alerts in New Relic, Prometheus or Grafana. Open source, works with Hangfire and Quartz.NET without code changes, one line for a BackgroundService.

Why: every team I've worked on has had a job that quietly stopped running. It didn't fail, so nothing fired. The app was up, so health checks were green. Someone noticed days later when a report was missing.

Setup:

builder.Services.AddRunSignal()
    .AddWorkload("nightly-invoice", o =>
    {
        o.Schedule = "0 2 * * *";
        o.MaxDuration = TimeSpan.FromMinutes(30);
        o.MinProcessed = 100;
    });

builder.Services.AddOpenTelemetry()
    .WithMetrics(m => m.AddRunSignalInstrumentation().AddOtlpExporter());

With Hangfire or Quartz.NET, .UseRunSignal(sp) records every job, and recurring jobs register with their cron expression at startup. A job that never fires still gets a "missed" alert. For your own code, wrap the work in workload.RunAsync(...). A BackgroundService loop calls workload.Beat() on every pass.

You get an alert when a job:

  • misses its schedule (cron plus grace period, time-zone aware);

  • hangs past its max duration without finishing;

  • stalls, meaning a worker loop stops sending heartbeats;

  • fails, overruns its max duration, or processes too little (it "succeeded" with 0 invoices).

New in 0.4.0: a GitHub Action that comments on pull requests with the alerts that change when someone edits a job's limits ("a run takes longer than 45m → 1h") or its owner (screenshot above). Also per-job Owner and RunbookUrl, and a Grafana alerting export.

A few C# details:

  • WorkloadRun is a struct. Unfinished runs live in a fixed slot array freed with a compare-and-swap, so a run allocates nothing and takes no lock.

  • The CLI is a Native AOT binary of about 10 MB that you can COPY --from into images without .NET.

  • Durations in alert text used to follow the current culture: "1,5h" on my Turkish machine, "1.5h" in CI. Every provision from another machine "changed" the same alerts. They're culture-invariant now.

Packages: RunSignal.DotNet, RunSignal.OpenTelemetry, RunSignal.Hangfire, RunSignal.Quartz and RunSignal.Quartz4. There are also SDKs for Go, Java, Node, Python and Rust that emit the same metrics.

Solo project, pre-1.0. I'd like your feedback on the API, and on which scheduler to support next. MassTransit and NServiceBus consumers are on the list.

Repo: https://github.com/gokhanertogan/RunSignal
.NET docs: https://github.com/gokhanertogan/RunSignal/blob/main/docs/dotnet.md


r/csharp • • 1d ago

Showcase TenantGuard 1.0: tenant isolation checks for EF Core

10 Upvotes

Hey everyone, small side project that I've been working on. I've released TenantGuard 1.0.0, an open-source set of packages for EF Core 10 and 11. It's for applications that use query filters to keep tenant data separate, and it's licensed under Apache-2.0.

A new entity can be missing its tenant filter. An IgnoreQueryFilters() call or raw SQL query can bypass an existing one. These mistakes can be hard to spot when the code looks reasonable on its own.

TenantGuard checks for problems at several points:

  • At build time, five Roslyn analyzers (TG001–TG005) flag IgnoreQueryFilters() calls without a stated reason, raw SQL without a tenant-column comparison, and filter switches such as ABP's IDataFilter.Disable<IMultiTenant>(). The SQL checks cover EF Core, Dapper and ADO.NET.

  • At startup, 14 model rules check for missing tenant filters, filters frozen to one tenant by a captured constant or local variable, unique indexes that apply across tenants, and missing tenant indexes.

  • During SaveChanges, the write guard throws before an insert, update or delete involving another tenant's row reaches the database. It also rejects moving a row to another tenant.

  • In tests, the isolation probe seeds a row per tenant and checks isolation for reads, Find, updates, deletes and Include. Each check appears as a separate xUnit v3 or TUnit test.

Version 1.0 adds write checks for owned entities. For example, a change to order.Shipping.Street is checked against the tenant of the owning order.

Here's how to configure the write guard and startup validation:

builder.Services.AddDbContext<AppDbContext>(options => options
    .UseSqlServer(connectionString)
    .UseTenantGuard(tg => tg.CurrentTenant(ctx => ((AppDbContext)ctx).TenantId)));

builder.Services.AddTenantGuardStartupValidation<AppDbContext>();

It works with custom query filters, Finbuckle.MultiTenant and other tenancy libraries. For Finbuckle, it reads IsMultiTenant() without extra configuration. You can also run dotnet tenantguard validate in CI to check the model without a database.

If you try it on an existing application, I'd like to hear about false positives or leaks it misses. Open to any sort of feedback and critical feedback very much welcomed.


r/csharp • • 1d ago

ScriptLangCore

Thumbnail
reddit.com
0 Upvotes

r/csharp • • 1d ago

Experienced frontend developer about to join the C# world. Anything I should know?

3 Upvotes

Hey guys. I've worked primarily in front end development for about 10 years but I just landed a job to work in enterprise software written in C#. It seems there might be opportunities to work in game development later, too.

I'm a complete noob when it comes to C# or adjacent languages, so I'm essentially learning from scratch. This is an open ended post, please let me know if you have any tips, warnings, or even words of support. I feel like a junior again and I'm also wondering how I'll handle learning and coding something so far from my comfort zone in this age of AI.

Thank you.


r/csharp • • 1d ago

Kumiko: an Elm-inspired UI framework for C# that coding agents can test themselves

Thumbnail
reddit.com
0 Upvotes

r/csharp • • 1d ago

I built a modular WinUI 3 template where features are hot-swapped from the server while the app runs. Fork it for your own projects

Thumbnail
github.com
6 Upvotes

Hey everyone,

I’ve been working on a side project for a while and it’s finally at a point where I’m not embarrassed to show it. It’s called Golden Hive, a modular framework for WinUI 3 desktop apps on .NET 10.

The idea in short: the desktop app is just a shell. Features (documents, reports, user management…) are modules the app downloads from the server after you sign in. Each module is a WinUI part plus its own ASP.NET Core backend in a Docker container. Ship a new version of a module and the server rolls it out in stages (pilot users first). The running app then swaps it in without a restart.

What’s in there right now:

  • Runtime modules. Each one runs in its own AssemblyLoadContext, packages are signed, and modules can depend on each other.

  • Hot-swap. Running commands get drained or cancelled, the module is replaced, your open views come back.

  • Navigation wheel. Hold Ctrl+Tab and a radial wheel pops up. One ring holds your modules, the other your open views. Tab or the arrow keys move around, and you release Ctrl to jump there. It’s like Alt+Tab, but for the app itself, and once you’re used to it you barely touch the sidebar anymore.

  • Workflows you build inside the app. Forms, approvals and module steps, triggered by events, schedules or commands. The reference example: an invoice gets submitted, gets pre-checked, and lands in an approver’s inbox.

  • An AI agent that can run those workflows, with guardrails. There’s a kill switch, confidence thresholds and daily limits. Critical steps always need a human, and every decision is logged. It also works fully offline with a rules-based provider, no API key needed.

  • Impact analysis on module updates. Rename a workflow step and the server checks every workflow that uses it. It auto-migrates them if you declared the rename, flags them for review if needed, or holds the rollout if something would break. This is honestly my favorite part.

  • The usual desktop stuff: docking and floating windows that remember their monitor, a command palette (Ctrl+Shift+P), live notifications, English/German.

  • Backend: 12 services in Docker Compose plus Postgres with a demo company already filled in. docker compose up, sign in as admin, and you can click around.

Under the hood it’s pretty functional-programming heavy (Result/Validation types all the way down instead of exceptions), if that’s your thing.

Use it as a template: the whole thing is meant as a starting point for your own projects. Fork it, delete the demo modules, add your own. The README has a step-by-step guide for building a module (backend + WinUI client + workflow integration), and the architecture is all there: auth, permissions, module delivery, rollouts, notifications, workflows, Docker setup.

It’s not battle-tested in production yet. The backend has end-to-end tests, the WinUI side is still young. If you build on it, I’d love to hear what breaks. That’s exactly the feedback I need to get it there.

Repo: https://github.com/zenoxart/GoldenHiveFramework
License: Apache 2.0

Happy to answer questions!


r/csharp • • 1d ago

Where do you keep tests in a modular monolith architecture?

Thumbnail reddit.com
1 Upvotes

r/csharp • • 1d ago

my C# project, or four projects

0 Upvotes

I’d like to showcase my four open-source C# projects, do you think it’s realistic for a "vibecoder" to build something like this in a couple of weeks?

https://github.com/redbase-app/

I recommend checking it out with an AI

sorry for the cryptic post. What this is: four open-source .NET projects I use in my own commercial work.

  1. redb – typed object store on PostgreSQL/SQL Server/SQLite, no migrations, compare vs EF Core benchmark

  2. redb.Route – Apache Camel-style integration framework

  3. redb.Tsak – runtime container for routes (Karaf-like)

  4. redb.Identity – OAuth2.1/OIDC server

My question was how far AI-assisted development changes what one person can build.
and makes it possible to further develop what were previously only internal projects


r/csharp • • 1d ago

Bank API, reference project: .NET 11 update + OpenAPI 3.2 compliant

Thumbnail
reddit.com
1 Upvotes

r/csharp • • 2d ago

Discussion Are you guys actually coding by hand still in your day-to-day?

0 Upvotes

I still do, myself. I love coding and programming and am thinking of even learning new languages now, but given the course of LLMs, I wonder what's the purpose? In a year they've gone from "unusable trash" to actually making each developer many times as productive. There are still gaps in what it does. It still has issues with large contexts. It is good at small one-off things and tiny programs, but it quickly tends to bloat stuff and has no sense of something I'd call "taste" when designing things, be it visually or code architecture wise.

I wonder what is the purpose of C# as a language now.

Any greenfield project can just use Rust for the same velocity as in any other language. Developer experience doesn't really matter anymore productivity wise, when all code is written by an LLM.

I see the writing on the wall.


r/csharp • • 2d ago

Parquet.NET is now private?

Thumbnail
nuget.org
13 Upvotes

r/csharp • • 2d ago

Discussion Early return style survey

22 Upvotes

Style question on early returns.

On long functions I often leave out the else branch because otherwise the early return doesn't help much with code readability (IMHO of course). But what about shorter functions. For those using early returns in the first place, do you prefer varaint 1 or 2 and why?

if (TryGetCached(key, out T cached))
{
    return cached;
}

var result = await ReadValueAsync<T>().ConfigureAwait(false);
SetCached(key, result);
return result;

versus

if (TryGetCached(key, out T cached))
{
    return cached;
}
else
{
    var result = await ReadValueAsync<T>().ConfigureAwait(false);
    SetCached(key, result);
    return result;
}

r/csharp • • 2d ago

Could EF Core benefit from a higher-level command for creating entities?

Post image
0 Upvotes

I’ve been experimenting with a small EF Core CLI prototype called EFX, and it made me wonder if EF Core could eventually support a higher-level workflow for creating entities.

Today, adding a new entity usually means creating the class, adding the DbSet, creating a migration, and updating the database separately.

I was thinking about something along the lines of:

dotnet ef entity create Product

The idea would be for one command to handle the common workflow while keeping the existing dotnet ef commands unchanged.

The prototype is here:
https://github.com/dotnet/efcore/issues/39569

I’m mainly interested in the design question: would a higher-level command like this actually be useful in EF Core, or is keeping these operations separate preferable for good reasons?

Curious to hear how other EF Core developers see it.


r/csharp • • 2d ago

Showcase MediaPlayer – an open-source Linux video & music player built with Avalonia UI and libmpv. Looking for feedback

0 Upvotes

Hi everyone,

I've been working on MediaPlayer (mp), an open-source video and music player for Linux. It's written in C# / .NET 10 with Avalonia UI for the interface, and it uses mpv (via libmpv2) for playback.

The code is on GitHub under MPL 2.0: https://github.com/1R1an1/MediaPlayer

I'm sharing it here not to promote it, but because I want feedback so I can make it better. I'd especially appreciate input on:

  • UI and UX: Does the interface feel intuitive? What's confusing or missing?

  • Performance and stability: Any issues with playback, memory use, or threading?

  • Installation: Did the install script run without errors on your distro? If not, which step failed?

  • Desktop integration: Do media keys, MPRIS, and file associations behave as you'd expect?

  • Missing features: What feature do you think this player is missing?

I'm also happy to hear what you'd want from a player like this.

Thanks for reading. Criticism is welcome.


r/csharp • • 2d ago

Help Moq is really slow when making lots of setup calls. How can I improve this?

20 Upvotes

I'm trying to refactor some legacy code, and I created some tests to replicate the original design behavior. I have a function that needs to be mocked, but it gets called for 20k+ different inputs in each test, where I have to do in a sense, mock.Setup(x => x.SomeFunction(input[i]).Returns(y => SomeFastFunction(input[i])); in a loop. This takes about a minute of execution time just to do this small loop, per test.

Is there a way to shorten this execution time, while being constrained to the original design?


r/csharp • • 3d ago

Showcase From a PS3 club notebook to a C#/WPF management app

10 Upvotes

I run a PlayStation club and develop Time Control, a Windows app for managing PC and console clubs. Back in 2016, I had five TVs with PS3s and kept session times and payments in a notebook. I later tried existing club software and eventually started working on my own. I use AI tools during development, with requirements coming from the day-to-day work at the club.

The current stack is C#, WPF, .NET 10 and SQLite. There’s an admin app, a separate agent on the PCs, and shared libraries for session contracts, payments and device control. The screenshot is the console dashboard: station status, timers, tariffs, payments and shop orders. The PC agent handles locking/unlocking; TV control works through compatible smart plugs. There’s still quite a bit of orchestration in the dashboard code, so I wouldn’t call it clean MVVM.

A lot of the work is around keeping state consistent. For example, a background autosave mustn’t overwrite session changes from a newer sale. Those paths share a lock, and a revision check drops stale snapshots. Sales, stock movements, receipts and related session changes are committed in one SQLite transaction. Once that succeeds, a UI refresh error can’t be treated as a failed sale — otherwise the operator might retry it and charge the customer twice. Payments also need more than an IsPaid flag: the first hour can be paid while an extension is still outstanding, so charges and received payments are tracked separately using decimal.

The remote PC adds another state to reconcile. The protocol carries session IDs, revisions and explicit running/paused/disconnected states. A ping response alone doesn’t tell the admin app what session is actually running. I’d be interested in how others test recovery around this boundary: the DB commit succeeds, but the UI refresh or communication with the agent fails afterwards.


r/csharp • • 3d ago

Showcase ORM that's faster than Dapper and LINQ to DB

0 Upvotes

I've been developing Nextorm, an ORM library for .NET, for quite a while now. With the advent of agentic development tools, the process has become noticeably faster and easier, but for me it remains a large and serious engineering project. Today I'd like to present an important milestone in this work: the first stable release, 1.0.9.

The idea behind Nextorm is to combine Dapper-level performance with the convenience of automatically generating SQL from C# constructs. Instead of writing SQL manually, developers describe queries using strongly typed expressions, with compile-time checks of types and property access, IntelliSense support, and familiar refactoring tools.

For example:

var row = dataContext.From<SimpleEntity>()
    .Where(x => x.Id == 1)
    .Select(x => new { x.Id })
    .Single();

In concept and spirit, Nextorm is closer to LINQ to DB. However, the library uses its own API based on C# expression trees rather than a standard LINQ provider. These trees are used to generate SQL and build efficient mappers from query results to .NET types. In JIT mode, mapping expressions are compiled into delegates and then reused when reading data from the database.

The library supports SQLite, SQL Server, PostgreSQL, MySQL, MariaDB, and ClickHouse. The API covers a wide range of features of these database systems: joins, grouping, CTEs, window functions, and provider-specific constructs. It's important to me that developers don't have to switch to handwritten SQL as soon as a query becomes more complex than a simple select.

https://alexeyshirshov.github.io/nextorm/guide/provider-specific-sql/overview.html

Performance has been one of the key priorities from the beginning, with Dapper serving as the benchmark. In the published SQLite benchmarks, Nextorm delivers comparable performance in many scenarios and surpasses that benchmark in some. The results, measurement conditions, and test source code are available in the repository.

https://alexeyshirshov.github.io/nextorm/comparisons/benchmarks.html

Below is a table of performance measurements for compiled/prepared queries across four libraries.

MethodNextormDapperlinq2dbEF Core
Data fetch10.75 μs15.80 μs16.50 μs38.46 μs
Wide data fetch9.135 ms9.883 ms10.594 ms10.998 ms
Where915.0 μs1,378.8 μs1,432.3 μs3,540.1 μs
Simulate work8.610 ms27.766 ms418.616 ms109.613 ms
Any923.5 μs1,421.9 μs1,523.8 μs3,742.6 μs
FirstOrDefault93.64 μs148.96 μs363.31 μs368.44 μs
SingleOrDefault92.38 μs142.69 μs372.78 μs369.31 μs
CASE WHEN9.45 μs14.64 μs15.43 μs36.91 μs
CTE9.89 μs22.25 μs23.75 μs—
SELECT DISTINCT11.44 μs18.27 μs18.36 μs42.53 μs
EXCEPT11.41 μs18.13 μs21.57 μs46.40 μs
IN-list12.79 μs18.55 μs47.92 μs66.24 μs
INTERSECT10.59 μs16.64 μs20.33 μs44.07 μs
4-table join13.27 μs27.17 μs24.65 μs50.99 μs
LEFT JOIN12.65 μs21.22 μs21.63 μs45.27 μs
Recursive CTE12.95 μs26.02 μs28.50 μs—
String functions9.33 μs14.22 μs15.25 μs36.89 μs
UDF9.43 μs14.28 μs15.31 μs36.24 μs
Window functions14.99 μs31.84 μs34.65 μs—

There is also experimental NativeAOT support, so far tested with SQLite on .NET 11 under Linux x64. A sample application from the repository was successfully compiled into a native executable without changes to the application code, simply by enabling PublishAot=true. Support is still partial: this does not mean that every query with every provider will already work under AOT.

https://alexeyshirshov.github.io/nextorm/infrastructure/05-nativeaot.html

Another feature is executing queries without materializing results into objects. You don't have to create a DTO for every row: you can obtain a DbDataReader to read the data yourself, or write results directly to a Stream in JSON or CSV format. This makes it possible, for example, to send data to an HTTP response or a file without intermediate objects or loading the entire result set into memory.

app.MapGet("/orders", async (HttpContext http, DateTime from, decimal minTotal, CancellationToken ct) =>
{
    using var ctx = new DataContextBuilder()
        .UsePostgres(connectionString)
        .CreateDataContext();

    http.Response.ContentType = "application/x-ndjson; charset=utf-8";

    await ctx.From<Order>()
        .Where(o => o.CreatedAt >= from && o.Total > minTotal)   // captured -> @from, @minTotal
        .Select(o => new { o.Id, o.CreatedAt, o.Total })
        .WriteJsonAsync(http.Response.Body, new JsonStreamOptions
        {
            Mode = JsonStreamMode.NdJson,
            IgnoreNull = true,
        }, ct);                                                  // no positional list
});

I'd appreciate your comments, suggestions, and criticism. I'm especially interested in how convenient you find the API and which features you feel are missing for your use cases.

Note: This article was originally written in Russian by the author and translated into English with the assistance of AI.


r/csharp • • 3d ago

Best resources to learn ASP.NET Core Web API, EF Core, and SQL Server?

13 Upvotes

Hey everyone! I'm learning backend development with C# and ASP.NET Core Web API, Entity Framework Core, and SQL Server.

I already know the basics, but I want to gain more real-world experience and learn industry best practices.

Could you recommend any courses, tutorials, or project-based resources that would help me become job-ready as a .NET backend developer?