Architecture contract (ARCH1202)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key dotnet.architecture.contract · Severity error · Category architecture
Flags a type reference against the layer direction, against vertical slice boundaries or against the project’s own architecture rules: a service or data class that uses a controller or page, a domain type that uses a service or the data context, a controller that reaches the data context directly while the rest of the solution goes through services, a feature under Features/ or Slices/ that uses another feature’s implementation class (its handlers and services - sending its commands or using its DTOs is allowed), or any dependency a rule in Project settings > Scanning forbids. Layers and features are read from folders and project names, not from class names.
Incorrect
Section titled “Incorrect”public class OrderService(AppDbContext db, OrdersController controller) { }Correct
Section titled “Correct”public class OrderService(IOrderRepository orders) { }