From f297bdf913032c4634493e84baa3ef0e4ef83940 Mon Sep 17 00:00:00 2001 From: Ryan Elian Date: Thu, 6 Feb 2020 05:21:19 +0700 Subject: [PATCH] Version 2.0.0 BREAKING CHANGES: - Changed component namespace from FluentValidation.FluentValidator to Microsoft.AspNetCore.Components.Forms.FluentValidator to solve namespace-related issues when used in projects with Accelist.* namespace! - Set ServiceScope property in component to private. (Accidentally made public!) --- .../Accelist.FluentValidation.Blazor.csproj | 5 ++++- FluentValidation.Blazor/FluentValidator.cs | 5 ++--- README.MD | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/FluentValidation.Blazor/Accelist.FluentValidation.Blazor.csproj b/FluentValidation.Blazor/Accelist.FluentValidation.Blazor.csproj index 1d021c4..9abdff4 100644 --- a/FluentValidation.Blazor/Accelist.FluentValidation.Blazor.csproj +++ b/FluentValidation.Blazor/Accelist.FluentValidation.Blazor.csproj @@ -25,8 +25,11 @@ Validator parameter may also be passed directly to the component to inline the A https://github.com/ryanelian/FluentValidation.Blazor Git true - 1.4.0 + 2.0.0 icon.png + Version 2.0.0 BREAKING CHANGES: +- Changed component namespace from FluentValidation.FluentValidator to Microsoft.AspNetCore.Components.Forms.FluentValidator to solve namespace-related issues when used in projects with Accelist.* namespace! +- Set ServiceScope property in component to private. (Accidentally made public!) diff --git a/FluentValidation.Blazor/FluentValidator.cs b/FluentValidation.Blazor/FluentValidator.cs index 0235318..8f5e1b6 100644 --- a/FluentValidation.Blazor/FluentValidator.cs +++ b/FluentValidation.Blazor/FluentValidator.cs @@ -1,12 +1,11 @@ -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Forms; +using FluentValidation; using Microsoft.Extensions.DependencyInjection; using System; using System.Collections; using System.Collections.Generic; using System.Text; -namespace FluentValidation +namespace Microsoft.AspNetCore.Components.Forms { /// /// Add Fluent Validator support to an EditContext. diff --git a/README.MD b/README.MD index cd6c2a4..ef92501 100644 --- a/README.MD +++ b/README.MD @@ -23,7 +23,7 @@ This library is a direct replacement to [the default Blazor ` - +
@@ -61,12 +61,13 @@ public class FormModelValidator : AbstractValidator } ``` -The `` component automatically detects the `Model` data type used by the parent `` then attempts to acquire the corresponding `FluentValidation.IValidator` for that model data type. +The `` component automatically detects the `Model` data type used by the parent `` then attempts to acquire the corresponding `FluentValidation.IValidator` for that model data type. For this reason, [in addition to coding the usual `FluentValidation.AbstractValidator Fluent Validation implementation`](https://fluentvalidation.net/start), **you are required to register the `FluentValidation.IValidator` implementation in the `Startup.cs` Service Provider (Dependency Injection)**: ```cs services.AddTransient, CreateAccountFormModelValidator>(); +// Alternatively, use FluentValidation.DependencyInjectionExtensions package (read further down below...) ``` **This effectively allows you, dear programmer, to inject required services to your validation implementations for writing amazing custom validation methods!** :fire: