Hot Chocolate is the premier GraphQL server for .NET. Version 11 brings “Zero Latency” execution engine improvements. Setup Projection The real power is in [UseProjection]. It translates nested GraphQL queries into optimized EF Core SQL queries (SELECT only what is requested).
Read more โTag: .NET
Dependency Injection in .NET: Service Lifetimes
Choosing the right lifetime for your services is critical for app correctness and memory usage. Transient Created every time it is requested. Lightweight, stateless services. Scoped Created once per HTTP request. Ideal for DB contexts, user session data. Don’t inject Scoped into Singleton! Singleton Created once per application lifetime. Examples: Caching services, configuration. MUST be […]
Read more โ.NET 6 Preview: What’s on the Roadmap
With .NET 5 shipped, Microsoft is effectively executing on its annual release cadence. .NET 6 is scheduled for November 2021. Based on GitHub issues and planning docs, here is what we can expect from the next Long Term Support (LTS) release. MAUI (Multi-platform App UI) The evolution of Xamarin.Forms into MAUI was delayed from .NET […]
Read more โC# 9.0 Top-Level Programs: Reducing Boilerplate
For 20 years, every C# console application started with the same ceremony: namespace, class Program, static void Main(string[] args). C# 9.0 and .NET 5 change this with Top-level programs. The Change Here is the “Hello World” of the past: Here is C# 9: How It Works The compiler essentially wraps your top-level code into a […]
Read more โEntity Framework Core 5.0: Many-to-Many and More
Entity Framework Core 5.0 ships alongside .NET 5 and brings features that developers have missed since EF6. It completes the “missing features” gap while pushing performance further. Many-to-Many Relationships Finally! You no longer need to manually map the join table entity. EF Core 5 creates it for you automatically. Split Queries A common performance pitfall […]
Read more โSource Generators in C# 9: Compile-Time Code Generation
Metaprogramming in C# has historically relied on reflection (slow at runtime) or T4 templates (clunky build integration). C# 9 changes the game with Source Generators. They allow you to hook into the compilation process, inspect your code, and generate new C# files on the fly that get compiled with your project. How It Works Example: […]
Read more โ