• Stars
    star
    196
  • Rank 198,553 (Top 4 %)
  • Language
    C#
  • License
    MIT License
  • Created over 5 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Validation extensions for Microsoft Blazor / FluentValidation

Blazor-Validation

Blazor-Validation is a validation agnostic library for validating forms in Blazor- Microsoft aspdotnet Blazor project.

Join the chat at https://gitter.im/mrpmorris/blazor-validation

Installation

You can download the latest release / pre-release NuGet packages from the official NuGet pages:

Getting started

  1. Add a reference to Morris.Blazor.Validation
  2. Inside the <EditForm> in your razor files, add <Morris.Blazor.Validation.Validate/>
  3. In startup.cs add using Morris.Blazor.Validation and then add the relevant validation in the ConfigureServices method.
  • services.AddFormValidation(config => config.AddDataAnnotationsValidation());
  • services.AddFormValidation(config => config.AddFluentValidation(typeof(SomeValidator).Assembly));

It is possible to add as many validation providers as you wish

services.AddFormValidation(config => 
  config
    .AddDataAnnotationsValidation()
    .AddFluentValidation(typeof(SomeValidator).Assembly)
);

Also you can have the FluentValidation extension scan multiple assemblies

services.AddFormValidation(config => 
  config
    .AddFluentValidation(
      typeof(SomeValidator).Assembly,
      typeof(ClassInAnotherDll).Assembly,
      andAnotherAssembly,
      andYetAnotherAssembly));

The standard Blazor components <ValidationSummary> and <ValidationMessage> will now work with your selected validation options.

Sample projects

More sample projects will be added as the framework develops.

What's new

New in 3.0.0

  • Add OnTransformModel delegate to allow the model to be transformed before validation (This is useful when using endpoint-centric APIs)
  • Major change because it changes the signature of the public IValidationProvider interface.

New in 2.0.0

  • Add net7.0 target framework.

New in 1.8.0

  • Use Services.TryAddScoped instead of Services.AddScoped for validators, in case the consuming app has already registered validators with a different lifetime.

New in 1.7.0

  • Upgrade to FluentValidation V10
  • Prevent ValidateObjectTree from visiting struct properties Bug #33

New in 1.6.0

  • Suport FluentValidation's RuleForEach and ChildRules

New in 1.5.0

  • Support .NET 5.0

New in 1.4.0

  • Upgrade to FluentValidation 9

New in 1.3.1

  • Add new EditContext.ValidateProperties for validating sub-sets of an object

New in 1.2.0

  • Return bool from EditContext.ValidateProperty

New in 1.0.0

  • Updated FluentValidationSample
  • First major release

New in 0.10

  • Remove old EditContextExtensions file
  • Ensure strings are not enumerated when traversing a whole object tree to validate

New in 0.9

  • Upgraded to .NETCore 3

New in 0.8

  • Upgraded to Blazor RC1

New in 0.7

  • Added an EditContext.ValidateObjectTree
  • Upgraded to Blazor Preview 9

New in 0.6.1

  • Fixed bug in FluentValidation that prevented objects with complex property types from being validated

New in 0.6.0

  • Upgraded to Blazor Preview 8

New in 0.5.0

  • Upgraded to Blazor Preview 7

New in 0.4.0

  • Initial public release

More Repositories

1

Fluxor

Fluxor is a zero boilerplate Flux/Redux library for Microsoft .NET and Blazor.
C#
1,244
star
2

blazor-university

Accompanying source code for blazor-university.com
HTML
189
star
3

Morris.Moxy

Moxy - Mixins code generator for C#
C#
112
star
4

WalkThrough-AzureActiveDirectoryMultiTenant

Azure Active Directory multi-tenant walkthrough
HTML
34
star
5

Reducible

C#
28
star
6

WebFrontEndComparison

TypeScript
14
star
7

Morris.Blazor.ControlFlow

HTML
13
star
8

Morris.EasyAuth

An easy auto framework
C#
9
star
9

the-periodic-table-of-elements-game

A game to help to learn the periodic table of elements, written in Blazor
C#
9
star
10

Cascade

C#
7
star
11

Morris.MetaMerge

Fody Weaver for creating patterns of .net attributes and applying them to multiple targets
C#
6
star
12

iGaze

An application for Windows that helps disabled people to regain their voice by typing with their eyes. Useful for people with various disabilities such as Locked-In Syndrome. This software requires a Tobii 4C eye tracker costing approximately 150 Euros (at the time of writing).
C#
5
star
13

DomainDrivenDesignWithCqrs

C#
4
star
14

Delphi-DIBControls

Source code for some multimedia controls I wrote for Delphi a (very) long time ago
Pascal
4
star
15

blazor-pre-rendering

HTML
3
star
16

Morris.FastStrings

C#
3
star
17

blazor-university-website

Content for blazor-university.com
HTML
2
star
18

WebSocketLogger

C#
2
star
19

Morris.Blazor.Web.Modal

Modal support or Blazor Web
C#
2
star
20

DeclarativeValidation

C#
2
star
21

Morris.BasicAuth

C#
2
star
22

BlazorLocalStorageWithSubscription

Demo BlazorLocalStorageWithSubscription
HTML
1
star
23

Morris.Immutable

C#
1
star
24

blazor-fluxor

1
star
25

Morris.DotNetToZod

C#
1
star
26

StronglyTypedIdMixins

Moxy mixin for entity strongly typed Ids
C#
1
star
27

Morris.DataAnnotations.ObjectTreeValidator

A validator that walks an entire object tree and validates using ValidationAttributes
C#
1
star
28

BlazorApp88AAdTestApp.Client

HTML
1
star
29

dotnet-IDisposable-memory-leak

HTML
1
star
30

Morris.Azure.Functions.OpenTelemetry

C#
1
star