Skip to content

FluentValidation validators: migrate the sample into CodeMazeGuides on net10.0 - #2145

Open
vladimir-pecanac-main wants to merge 1 commit into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/53698-deep-dive-validators-fluentvalidation
Open

FluentValidation validators: migrate the sample into CodeMazeGuides on net10.0#2145
vladimir-pecanac-main wants to merge 1 commit into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/53698-deep-dive-validators-fluentvalidation

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Migrates the sample for FluentValidation Validators in C#: Built-in and Custom out of the standalone CodeMazeBlog/fluent-validation-aspnetcore repository (branch fluent-validation-validators-deep-dive) and into dotnet-client-libraries/FluentValidationValidators, so the per-article CI gate builds and tests it.

  • netcoreapp3.1 -> net10.0 for both projects; FluentValidation 9.0.1 -> 12.1.1.
  • Startup.cs and the generic host replaced by minimal hosting in Program.cs.
  • CascadeMode.StopOnFirstFailure -> CascadeMode.Stop. The old member is removed in 12.x, not deprecated, so the original line is a hard CS0117.
  • FluentValidation.AspNetCore dropped: it stops at 11.3.1 with no 12.x, so it cannot pair with core 12.1.1, and its automatic-validation pipeline is the approach the maintainers no longer recommend for new projects. Validators are registered with AddValidatorsFromAssemblyContaining() and invoked explicitly in OrdersController.
  • New Tests project (MSTest) covering the custom FullName() message, cascade behaviour, IsInEnum(), RuleForEach() indexing, and the exact strings EmailAddress() accepts and rejects.

dotnet build 0 warnings 0 errors, dotnet test 13/13 on SDK 10.0.302 / runtime 10.0.10.

…n net10.0

Moves the sample for 'FluentValidation Validators in C#: Built-in and Custom'
out of the standalone CodeMazeBlog/fluent-validation-aspnetcore repository and
into dotnet-client-libraries/FluentValidationValidators, so the per-article CI
gate builds and tests it like every other sample.

- netcoreapp3.1 -> net10.0 for both projects; FluentValidation 9.0.1 -> 12.1.1.
- Startup.cs and the generic host replaced by minimal hosting in Program.cs.
- CascadeMode.StopOnFirstFailure -> CascadeMode.Stop. The old member is removed
  in 12.x, not deprecated, so the original line no longer compiles.
- FluentValidation.AspNetCore dropped: it stops at 11.3.1 and cannot pair with
  core 12.1.1, and its automatic-validation pipeline is the approach the
  maintainers no longer recommend for new projects. Validators are registered
  with AddValidatorsFromAssemblyContaining() and invoked explicitly in
  OrdersController.
- New Tests project (MSTest) covering the custom FullName() message, cascade
  behaviour, IsInEnum(), RuleForEach() indexing, and the exact strings
  EmailAddress() accepts and rejects.
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