ITLab.Template.DevPack — CoreConsts
Centralized infrastructure constants shared across DevPack areas and consuming projects.
Componentes
| Tipo | Nome | Responsabilidade |
|---|---|---|
| Static Class | CoreConsts | Root-level constants: regex, SQL collation, MIME type, timing, connection string keys, claim names, Entra ID claim URIs, and default values |
| Nested Static Class | CoreConsts.SensitiveData | Constants for the sensitive-data reveal header and redaction mask value |
Como usar
// Configure SQL collation for accent-insensitive LIKE queries.
modelBuilder.UseCollation(CoreConsts.SqlCollateLikeQuery);
// Detect unauthenticated context in middleware or guards.
if (currentUser.UserId == CoreConsts.Unauthenticated)
return Unauthorized();
// Return an Excel file with the correct MIME type.
return File(bytes, CoreConsts.ExcelContentType, "report.xlsx");
// Reference the sensitive-data reveal header.
var reveal = request.Headers[CoreConsts.SensitiveData.RevealHeader];
O que não fazer
- Do not add product-specific constants here — define those in the consuming project's own constants class.
- Do not use
DefaultCreatedByas a real user identifier in audit trails; it is a sentinel for unauthenticated writes only. - Do not persist
Unauthenticated(int0) as a valid user ID in any production table.
Extensão pelo produto
CoreConsts is not extensible — all values are compile-time literals. Products follow the same static-class pattern and define their own constants in their own namespaces.