<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/better-dependency-injection-with-scrutor-in-asp-net-core-rcpggppgh" -->

---
title: Better Dependency Injection with Scrutor in ASP.NET Core
description: Scrutor extends ASP.NET Core's built-in dependency injection container by adding assembly scanning for automatic service registration and a Decorate method for...
canonical: https://daily.dev/posts/better-dependency-injection-with-scrutor-in-asp-net-core-rcpggppgh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Better Dependency Injection with Scrutor in ASP.NET Core | daily.dev
og:description: Scrutor extends ASP.NET Core's built-in dependency injection container by adding assembly scanning for automatic service registration and a Decorate method for...
og:url: https://daily.dev/posts/better-dependency-injection-with-scrutor-in-asp-net-core-rcpggppgh
og:image: https://api.daily.dev/og/posts/rCpggppgH.png
og:image:alt: Better Dependency Injection with Scrutor in ASP.NET Core
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Better Dependency Injection with Scrutor in ASP.NET Core

**[NikolaTech](https://daily.dev/sources/nikolatech)** · 5 min read · 0 upvotes · 0 comments

## Summary

Scrutor extends ASP.NET Core's built-in dependency injection container by adding assembly scanning for automatic service registration and a Decorate method for cleanly wrapping services without boilerplate lambda code. The piece walks through installing the Scrutor NuGet package, using Scan with marker interfaces to auto-register services by lifetime (transient, scoped, singleton), and chaining multiple decorators cleanly instead of manual provider lambdas. It also notes Scrutor relies on reflection at startup, which has negligible performance impact, and mentions ZZZ Projects as a sponsor of the library.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://nikolatech.net/blogs/scrutor-asp-dotnet-core>

## Questions this post answers

### How do I automatically register all services in an assembly with ASP.NET Core dependency injection?

Use Scrutor's Scan extension method on IServiceCollection, calling FromAssemblyOf to target an assembly, AddClasses to find classes implementing interfaces, AsImplementedInterfaces to map them, and WithTransientLifetime (or scoped/singleton) to set lifetime. This replaces manually writing AddTransient calls for every service, reducing boilerplate and forgotten registrations as a project grows.

_Developers streamlining DI setup in growing codebases track tooling like Scrutor on daily.dev._

### How can I apply multiple decorators to a service in ASP.NET Core without writing messy provider lambdas?

Chain Scrutor's Decorate method after registering the base service, for example services.AddScoped<IMyService, MyService>().Decorate<IMyService, LoggingMyService>().Decorate<IMyService, CachingMyService>(). Order matters: the first decorator wraps the original service and each subsequent call wraps the previous decorator, avoiding the nested lambda code required with the built-in container alone.

_Anyone wiring up service decorators in .NET can follow patterns like this via daily.dev._

## Similar posts on daily.dev

- [12 Rules for Dependency Injection in ASP.NET Core](https://daily.dev/posts/12-rules-for-dependency-injection-in-asp-net-core-nirfrs5ef) · We Are .NET · 3 upvotes · 1 comments
- [How Dependency Injection Containers Use Reflection Internally in C\#](https://daily.dev/posts/how-dependency-injection-containers-use-reflection-internally-in-c--3wucpbuw4) · We Are .NET · 3 upvotes · 0 comments
- [How to use keyed services in ASP.NET Core](https://daily.dev/posts/how-to-use-keyed-services-in-asp-net-core-sn17l40rp) · InfoWorld · 2 upvotes · 0 comments
- [Best Libraries for ASP.NET Core in 2026 \(Opinionated\)](https://daily.dev/posts/best-libraries-for-asp-net-core-in-2026-opinionated--h4hgrvzmn) · Code with Mukesh · 18 upvotes · 0 comments

---

Tags: [#c#](https://daily.dev/tags/c#), [#aspnet](https://daily.dev/tags/aspnet), [#dependency-injection](https://daily.dev/tags/dependency-injection)

[View this post on daily.dev](https://daily.dev/posts/better-dependency-injection-with-scrutor-in-asp-net-core-rcpggppgh)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Better Dependency Injection with Scrutor in ASP.NET Core","url":"https://daily.dev/posts/better-dependency-injection-with-scrutor-in-asp-net-core-rcpggppgh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/better-dependency-injection-with-scrutor-in-asp-net-core-rcpggppgh"},"datePublished":"2026-10-04T13:06:54.603Z","dateModified":"2026-10-04T13:13:38.409Z","description":"Scrutor extends ASP.NET Core's built-in dependency injection container by adding assembly scanning for automatic service registration and a Decorate method for...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/cb8b65df303e5218bc08db7dad0be01a?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/cb8b65df303e5218bc08db7dad0be01a?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"NikolaTech","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"NikolaTech","logo":"https://media.daily.dev/image/upload/s--1h2fO6FL--/f_auto,q_auto/v1791119050/logos/nikolatech?_a=BAMAMicg0","url":"https://daily.dev/sources/nikolatech"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/better-dependency-injection-with-scrutor-in-asp-net-core-rcpggppgh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"c#,aspnet,dependency-injection","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"NikolaTech","item":"https://daily.dev/sources/nikolatech"},{"@type":"ListItem","position":3,"name":"Better Dependency Injection with Scrutor in ASP.NET Core"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/better-dependency-injection-with-scrutor-in-asp-net-core-rcpggppgh#faq","mainEntity":[{"@type":"Question","name":"How do I automatically register all services in an assembly with ASP.NET Core dependency injection?","acceptedAnswer":{"@type":"Answer","text":"Use Scrutor's Scan extension method on IServiceCollection, calling FromAssemblyOf to target an assembly, AddClasses to find classes implementing interfaces, AsImplementedInterfaces to map them, and WithTransientLifetime (or scoped/singleton) to set lifetime. This replaces manually writing AddTransient calls for every service, reducing boilerplate and forgotten registrations as a project grows. Developers streamlining DI setup in growing codebases track tooling like Scrutor on daily.dev."}},{"@type":"Question","name":"How can I apply multiple decorators to a service in ASP.NET Core without writing messy provider lambdas?","acceptedAnswer":{"@type":"Answer","text":"Chain Scrutor's Decorate method after registering the base service, for example services.AddScoped<IMyService, MyService>().Decorate<IMyService, LoggingMyService>().Decorate<IMyService, CachingMyService>(). Order matters: the first decorator wraps the original service and each subsequent call wraps the previous decorator, avoiding the nested lambda code required with the built-in container alone. Anyone wiring up service decorators in .NET can follow patterns like this via daily.dev."}}]}
```

