-
Notifications
You must be signed in to change notification settings - Fork 306
Expand file tree
/
Copy pathCreateContactCommandValidator.cs
More file actions
30 lines (23 loc) · 1.08 KB
/
CreateContactCommandValidator.cs
File metadata and controls
30 lines (23 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//------------------------------------------------------------------------------
// <auto-generated>
// CleanArchitecture.Blazor - MIT Licensed.
// Author: neozhu
// Created/Modified: 2025-03-19
// Validator for CreateContactCommand: enforces max lengths and required fields for Contact entities.
// Docs: https://docs.cleanarchitectureblazor.com/features/contact
// </auto-generated>
//------------------------------------------------------------------------------
// Usage:
// Validates CreateContactCommand ensuring constraints (e.g., non-empty Name field) before execution.
namespace CleanArchitecture.Blazor.Application.Features.Contacts.Commands.Create;
public class CreateContactCommandValidator : AbstractValidator<CreateContactCommand>
{
public CreateContactCommandValidator()
{
RuleFor(v => v.Name).MaximumLength(50).NotEmpty();
RuleFor(v => v.Description).MaximumLength(255);
RuleFor(v => v.Email).MaximumLength(255);
RuleFor(v => v.PhoneNumber).MaximumLength(255);
RuleFor(v => v.Country).MaximumLength(255);
}
}