Structure and order your DI container
A guide to organizing a .NET Dependency Injection container using extension methods for better structure and maintainability.
Steven Giesel is a Senior Software Engineer and Microsoft MVP with over 13 years of experience, specializing in .NET and modern backend development. He shares deep technical knowledge across topics such as C#, EF Core, RavenDB, distributed systems, and cloud-native architectures, and is an active speaker in the .NET community.
311 articles from this blog
A guide to organizing a .NET Dependency Injection container using extension methods for better structure and maintainability.
A comprehensive guide to the various collection-like types in .NET (C#), explaining their differences, use cases, and best practices for selection.
A guide to building a simple Dependency Injection container in .NET, explaining IoC and DI concepts with code examples.
Explains how to delete a database record in Entity Framework without loading it first, covering both classic and .NET 7+ methods.
An analysis of ChatGPT's capabilities and limitations for .NET and general programming, including code generation accuracy and its impact on platforms like Stack Overflow.
Explains the new Environment.IsPrivilegedProcess API in .NET 8 for checking if a process has administrator rights.
Explains the key differences between abstraction and encapsulation, two fundamental object-oriented programming concepts.
Explores how to make a StringBuilder enumerable in C# using compiler duck typing and extension methods, despite it not implementing IEnumerable.
Explores new ArgumentException helper methods proposed for .NET 8, including ThrowIfNullOrWhiteSpace and ThrowIfNullOrEmpty for collections.
Explores new code analyzers coming in .NET 8, focusing on performance improvements like case-insensitive string comparisons.
Explains the new FrozenSet and FrozenDictionary collections in .NET 8, detailing their performance benefits and differences from read-only and immutable collections.
Debunks the myth that StringBuilder is always faster in C#, showing scenarios where simple concatenation or List<string> is better.
Explains how to measure heap allocations in .NET and reveals that an empty array consumes 24 bytes due to object overhead.
A guide to using AutoFixture with xUnit to generate anonymous test data, making unit tests more robust and maintainable.
Explains software design patterns like Mediator, Strategy, Singleton, and Proxy using simple sketches and real-world analogies.
Explores the pitfalls of mutable value types in C#/.NET, explaining why they are often avoided and the performance reasons for their limited use.
Explains how to use .NET's ObsoleteAttribute and RequiresPreviewFeaturesAttribute to mark APIs as deprecated or experimental.
A collection of technical infographics covering .NET, C#, Entity Framework, exceptions, operators, and query safety.
Compares C# local functions and lambda expressions, highlighting key differences in recursion, yield usage, and performance.
Explains the difference between 'throw;' and 'throw exc;' in C#, focusing on how the latter truncates the stack trace.