Skip to content

Commit

Permalink
Merge pull request #40 from mrpmorris/release/1.8
Browse files Browse the repository at this point in the history
Release/1.8
  • Loading branch information
mrpmorris authored May 5, 2022
2 parents d196113 + 697d671 commit 38068ad
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 27 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ More sample projects will be added as the framework develops.

## What's new

### 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](https://github.com/mrpmorris/blazor-validation/issues/33)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
42 changes: 21 additions & 21 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<Project>

<PropertyGroup>
<PropertyGroup>

<Version>1.7.0</Version>
<AssemblyVersion>1.7.0.0</AssemblyVersion>
<FileVersion>1.7.0.0</FileVersion>
<Version>1.8.0</Version>
<AssemblyVersion>1.8.0.0</AssemblyVersion>
<FileVersion>1.8.0.0</FileVersion>

<Authors>Peter Morris</Authors>
<Company />
<Copyright>Peter Morris</Copyright>
<PackageLicenseFile></PackageLicenseFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<TargetFrameworks>netstandard2.1;net5.0</TargetFrameworks>
<Authors>Peter Morris</Authors>
<Company />
<Copyright>Peter Morris</Copyright>
<PackageLicenseFile></PackageLicenseFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<TargetFrameworks>netstandard2.1;net5.0;net6.0</TargetFrameworks>

<PackageProjectUrl>https://github.com/mrpmorris/blazor-validation</PackageProjectUrl>
<PackageIconUrl />
<RepositoryUrl>https://github.com/mrpmorris/blazor-validation</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageIconUrl />
<RepositoryUrl>https://github.com/mrpmorris/blazor-validation</RepositoryUrl>
<RepositoryType>git</RepositoryType>

<AssemblyOriginatorKeyFile>MrPMorris.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>MrPMorris.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>

<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

</PropertyGroup>
</PropertyGroup>

<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Description>FluentValidation for Blazor</Description>
Expand All @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentValidation" Version="10.0.4" />
<PackageReference Include="FluentValidation" Version="11.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using FluentValidation;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using PeterLeslieMorris.Blazor.FluentValidation;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -62,7 +63,7 @@ private static void ScanForValidators(IServiceCollection services, IEnumerable<A
.SelectMany(x => x.Value)
.Distinct()
.ToList()
.ForEach(x => services.AddScoped(x));
.ForEach(x => services.TryAddScoped(x));

services.AddSingleton(repository);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ public void InitializeEditContext(
EditContext editContext,
IServiceProvider serviceProvider)
{
#if NET6_0_OR_GREATER
editContext.EnableDataAnnotationsValidation();
#else
editContext.AddDataAnnotationsValidation();
#endif
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private static Object GetFieldState(EditContext editContext, FieldIdentifier fie
{
#if (NETSTANDARD2_0 || NETSTANDARD2_1)
Object[] parameters = new object[] { fieldIdentifier, true };
#elif (NET5_0)
#elif (NET5_0_OR_GREATER)
Object[] parameters = new object[] { fieldIdentifier };
#endif
EnsureGetFieldStateMethod(editContext);
Expand All @@ -130,7 +130,7 @@ private static void EnsureGetFieldStateMethod(EditContext editContext)
{
#if (NETSTANDARD2_0 || NETSTANDARD2_1)
var methodname = "GetFieldState";
#elif (NET5_0)
#elif (NET5_0_OR_GREATER)
var methodname = "GetOrAddFieldState";
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0" />
</ItemGroup>


<ItemGroup>
<None Include="blazor-validation.png">
<Pack>True</Pack>
Expand Down

0 comments on commit 38068ad

Please sign in to comment.