Architecture guard
Declare layers once. Domain cannot reference infrastructure, endpoints cannot construct a DbContext, repositories must be interfaces. The rules run while you type.
Architecture rulesRoslyn analyzers for .NET
RungerHeimdall turns architecture rules and hidden allocations into diagnostics you see in the IDE and in CI. No test project, no separate scan, no runtime profiler.
dotnet add package RungerHeimdall.Analyzers --version 1.0.0
Declare layers once. Domain cannot reference infrastructure, endpoints cannot construct a DbContext, repositories must be interfaces. The rules run while you type.
Architecture rulesEmpty params arrays, ToList before foreach, string concatenation inside loops, Enum.HasFlag boxing. Deterministic patterns the compiler will not warn about.
Performance rulesFreeze existing violations in a baseline, declare temporary exemptions with an expiry date, and report only what new code breaks.
BaselineThe analyzer reads your layer definitions and reports the dependency before it reaches review. The same rule fails the build in CI.
ARCH1001 'OrderService' is in layer 'Domain' but
depends on 'SqlRepository' in layer 'Infrastructure'.
Dependencies must flow inward.
Domain is the business core. It should not know
about persistence.
1. Define IOrderRepository in Domain.
2. Implement it in Infrastructure.
3. Inject it at the Api layer.