Kind: Service
Source: Pams/Data/Pams.Data/Pams.Data.csproj (line 1)
Part of: Pams
NuGet package dependency
System.ComponentModel.DataAnnotations is a NuGet package dependency declared by Pams.Data.csproj. It supports validation metadata on Pams.Data model properties, such as required fields, length constraints, and format rules, which .NET validation and model-binding code can evaluate.
Diagram
mermaidsequenceDiagram participant Client participant API participant Model as Pams.Data Model participant Validation as System.ComponentModel.DataAnnotations Client->>API: Submit request payload API->>Model: Bind payload to model Model->>Validation: Evaluate validation attributes Validation-->>API: Validation results API-->>Client: Return success or validation errors
Usage
tstype CreatePersonRequest = {
name?: string;
email?: string;
};
const request: CreatePersonRequest = {
name: "Ada Lovelace",
email: "ada@example.com",
};
const response = await fetch("/api/people", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(request),
});
if (!response.ok) {
const errors = await response.json();
console.error("Validation failed:", errors);
}
AI Coding Instructions
- Keep validation attributes on Pams.Data model properties so validation rules remain close to the data contract.
- Match client request field names and types to the model properties decorated with data-annotation attributes.
- Handle validation-error responses in API clients instead of assuming all submitted payloads are accepted.
- Check
Pams.Data.csprojbefore adding validation attributes to confirm the package reference remains available.
Used by
1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.
Injected or called by (1)
Pams.Data—Pams/Data/Pams.Data/Pams.Data.csproj:1
Was this page helpful?