Skip to content

Add lightweight Blazor profile validation sample - #10

Merged
balajibashyam merged 4 commits into
mainfrom
feature/blazor-forms-validation-sample
Aug 2, 2026
Merged

Add lightweight Blazor profile validation sample#10
balajibashyam merged 4 commits into
mainfrom
feature/blazor-forms-validation-sample

Conversation

@balajibashyam

Copy link
Copy Markdown
Contributor

Summary

Adds a minimal .NET 10 companion sample for the Blazor .NET 8 Forms & Validation: EditForm, FluentValidation & Server Error Handling tutorial.

What's included

  • New sample: blazor/forms-validation-masterclass/ — 16 files

    • Interactive Server Blazor Web App with manual EditContext
    • DataAnnotations validation on ProfileModel
    • Local FluentValidationBridge component (no archived adapter)
    • Whole-model validation on submit, property-specific on field change
    • Backend field-error mapping via ValidationMessageStore
    • Stale backend errors clear when the field is re-edited
    • Reusable FormTextField with aria-invalid and aria-describedby
    • Dirty-state detection with IsModified(), save/discard behavior
    • MarkAsUnmodified() after successful save
    • UseStatusCodePagesWithReExecute for custom 404
    • 8 bUnit component tests + 1 ASP.NET Core integration test
  • Root README: New sample row + updated Blazor tree (both sample folders)

  • GitHub Actions: New test-blazor-profile-validation job; path filters updated

Deliberately omitted (stays in the full tutorial)

  • Archived Blazor FluentValidation adapters, async validation, API ProblemDetails, JavaScript focus, navigation guards, optimistic UI, authentication, databases, WebAssembly, Docker

Versions

  • .NET SDK: 10.0.302
  • FluentValidation.DependencyInjectionExtensions: 12.1.1
  • bunit: 2.8.6
  • Microsoft.AspNetCore.Mvc.Testing: 10.0.10
  • xunit.v3: 3.2.2

Validation

  • dotnet restore — passed
  • dotnet build --configuration Release — passed (0 errors, 0 warnings)
  • dotnet test --configuration Release — passed (9/9)
  • HTTP GET / — 200 (seeded profile values rendered)
  • HTTP GET /this-page-does-not-exist — 404 (custom Not Found page, no redirect)
  • Security scan — clean

@balajibashyam
balajibashyam merged commit 15cecd2 into main Aug 2, 2026
12 checks passed
@balajibashyam
balajibashyam deleted the feature/blazor-forms-validation-sample branch August 2, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant