Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Core
  3. Scrutor

Scrutor

MITC#v7.0.0

Assembly scanning and decoration extensions for Microsoft.Extensions.DependencyInjection in .NET applications.

GitHubGitHub
4.4k stars280 forks0 contributors

What is Scrutor?

Scrutor is a .NET library that extends Microsoft.Extensions.DependencyInjection with assembly scanning and service decoration capabilities. It solves the problem of manually registering numerous services in dependency injection containers by automatically discovering types from assemblies, and enables clean implementation of the decorator pattern for cross-cutting concerns.

Target Audience

.NET developers using Microsoft's dependency injection container who need to reduce boilerplate service registration code or implement decorator patterns for cross-cutting concerns like logging, caching, or validation.

Value Proposition

Developers choose Scrutor because it provides missing but essential functionality for the standard Microsoft DI container with a clean, intuitive API that follows existing .NET patterns, eliminating the need for manual service registration or complex workarounds for decoration.

Overview

Assembly scanning and decoration extensions for Microsoft.Extensions.DependencyInjection

Use Cases

Best For

  • Automatically registering all repository or service classes in a large .NET application
  • Implementing decorator patterns for cross-cutting concerns like logging or caching in ASP.NET Core
  • Reducing boilerplate dependency injection setup code in microservices architectures
  • Registering compiler-generated UI types from frameworks like Avalonia
  • Handling open generic interfaces in dependency injection configurations
  • Applying consistent service lifetimes across multiple discovered implementations

Not Ideal For

  • Projects already using third-party DI containers like Autofac or Simple Injector with built-in scanning features
  • Applications with only a handful of services where manual registration is straightforward and maintainable
  • Teams requiring compile-time dependency validation or advanced DI features like property injection
  • Scenarios where performance is critical and assembly scanning overhead is unacceptable for large codebases

Pros & Cons

Pros

Efficient Assembly Scanning

Automatically discovers and registers types from assemblies using configurable filters, drastically reducing boilerplate code for DI setup, as shown in the scanning examples.

Clean Decorator Support

Provides a straightforward API to decorate services for cross-cutting concerns like logging or caching, enabling the decorator pattern without modifying original implementations.

Flexible Type Filtering

Supports filtering by base types, interfaces, namespaces, attributes, and even compiler-generated types for UI frameworks like Avalonia, as detailed in the README.

Open Generic Handling

Capable of scanning and registering open generic interfaces and types with multiple parameters, simplifying DI for generic patterns.

Cons

Compiler-Generated Type Pitfalls

The README warns that compiler-generated types (e.g., from UI frameworks) can implement many interfaces, leading to unintended registrations if filters are not precise, requiring careful configuration.

Limited to Microsoft DI

Scrutor only extends Microsoft.Extensions.DependencyInjection, creating vendor lock-in and making it unsuitable for projects using alternative containers with more features.

Potential Performance Overhead

Assembly scanning can introduce startup performance issues in large applications, as it reflects over all types, which might not be optimal for high-performance or minimal overhead scenarios.

Frequently Asked Questions

Quick Stats

Stars4,351
Forks280
Contributors0
Open Issues37
Last commit9 months ago
CreatedSince 2015

Tags

#scanning#hacktoberfest#asp-net-core#conventions#dependency-injection#service-registration#design-patterns#dotnet#aspnet-core#microservices#assembly-scanning

Built With

.
.NET

Included in

.NET21.2kCore21.2k
Auto-fetched 1 day ago

Related Projects

Microsoft.Extensions.DependencyInjectionMicrosoft.Extensions.DependencyInjection

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.

Stars18,372
Forks5,703
Last commit1 day ago
AutoMapperAutoMapper

A convention-based object-object mapper in .NET.

Stars10,187
Forks2,398
Last commit6 days ago
HumanizerHumanizer

Humanizer meets all your .NET needs for manipulating and displaying strings, enums, dates, times, timespans, numbers and quantities

Stars9,938
Forks1,067
Last commit6 days ago
FluentValidationFluentValidation

A popular .NET validation library for building strongly-typed validation rules.

Stars9,765
Forks1,276
Last commit12 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub