Files
Fuchs_Intranet/.github/instructions/csharp.instructions.md
T
Stefan 9c0bf76a05
Playwright Tests / test (push) Has been cancelled
Add project-wide instruction files for Fuchs migration
Added detailed instruction files for configuration, controller structure, C# standards, OCORE library usage, ImageSharp licensing, and testing. These documents define rules for settings, DI, file layout, package management, and test practices to ensure consistency and compliance during the .NET 10 migration.
2026-05-30 23:31:32 +02:00

1.8 KiB

applyTo
applyTo
**/*.cs

C# Coding Standards

Language & Target

  • All code must be written in C# targeting .NET 10.
  • The original Fuchs intranet was VB.NET; any remaining VB must be converted to C# during migration. Original VB reference lives at D:\My Programming\PWProjects\Fuchs\Fuchs\Areas\Intranet.

Style

  • Follow standard C# naming: PascalCase for classes and methods, camelCase for locals and parameters, _camelCase for private fields.
  • ImplicitUsings and Nullable are enabled in the Fuchs project — honor nullable annotations and avoid redundant using directives.
  • Prefer modern, performance-oriented features: async/await for I/O, LINQ for data manipulation, dependency injection for testability, switch expressions, target-typed new, and collection initializers.
  • Only add comments when they match the existing style or explain non-obvious logic. Do not over-comment.

File Size

  • Keep files to a soft limit of 400 lines (hard max 600).
  • Proactively refactor larger files into smaller, focused classes/partials — this is why IntranetController is split into domain partials.

Dependency Injection

  • Inject dependencies via constructor (ILogger<T>, IConfiguration, services). Do not use service-locator or static singletons in new class-level code.
  • Library classes accept optional loggers (ILogger<T>?) defaulting to NullLogger<T>.Instance — see logging.instructions.md.

Packages

  • Do not upgrade Spire.PDF beyond 8.10.5.
  • For builds failing because SixLabors.ImageSharp (v4.0.0+) requires a license, see imagesharp.instructions.md before downgrading.
  • Keep MailKit/MimeKit versions aligned with OCORE's referenced versions to avoid NU1605 package-downgrade-as-error.
  • Only add or update packages when necessary; prefer existing/OCORE libraries.