Session
Lazy is Better than Crazy: Winner Against the Spinner in .NET
Every .NET application starts with a clean controller and two dependencies.
Then reality hits: ten injected services, all instantiated on every request - whether used or not. This session dissects the hidden cost of constructor injection at scale and shows how two tools eliminate it without touching business logic.
We'll start with Lazy< T > and DryIoc: how to defer object construction to the exact moment it's needed, how to handle circular references elegantly, and how to measure the impact with Microsoft Aspire (spoiler: 4–5× reduction in DI construction time, heap allocations, and GC pressure - on real production endpoints).
Then we move to the second enemy: operations that are simply slow by nature - bulk printing, mass emails, heavy report generation. We'll walk through a real-world PrintSpooler built with Hangfire: fire-and-forget jobs, distributed locking to prevent race conditions, progress polling from the frontend, identity serialization outside the HTTP pipeline, and the one line you must never remove (throw) if you want retries to actually fire.By the end, you'll have a concrete playbook to stop your spinner - and keep your users alive.
Code samples are from a production .NET 10 / ASP.NET Core application.
Benchmarks were measured with Microsoft Aspire Dashboard on 500 consecutive real requests. Topics covered: Lazy< T >, DryIoc, Microsoft.Extensions.DependencyInjection, Hangfire (fire-and-forget, scheduled, recurring jobs), distributed cache, polling pattern.
Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.
Jump to top