Using Scrutor for Dependency Injection in ASP.NET Core API Applications
What is Scrutor? Scrutor is a NuGet package that extends the built-in Dependency Injection (DI) container of ASP.NET Core with assembly scanning and decoration capabilities. While ASP.NET Core provides a simple and effective DI container out of the box, it requires every service to be registered manually — one line of code per interface-to-implementation mapping. In large enterprise applications with dozens or hundreds of services, this manual registration becomes repetitive, error-prone, and difficult to maintain. Scrutor solves this problem by allowing developers to scan assemblies at startup and automatically discover and register all concrete classes that implement specific interfaces. Instead of writing individual AddScoped , AddTransient , or AddSingleton lines for each service, Scrutor enables a single builder.Services.Scan() call that handles all registrations from one or more assemblies. Scrutor vs. Built-in ASP.NET Core DI Aspect ...