Skip to content

Commit cac4431

Browse files
authored
Merge pull request #35 from mrpmorris/release/1.7
Release/1.7
2 parents 8edf091 + 960b1e2 commit cac4431

File tree

12 files changed

+51
-54
lines changed

12 files changed

+51
-54
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ More sample projects will be added as the framework develops.
4747
- [FluentValidation Sample]- Shows how to use the [FluentValidation.com] library to validate.
4848

4949
## What's new
50+
51+
### New in 1.7.0
52+
- Upgrade to FluentValidation V10
53+
- Prevent ValidateObjectTree from visiting struct properties [Bug #33](https://github.com/mrpmorris/blazor-validation/issues/33)
54+
55+
### New in 1.6.0
56+
- Suport FluentValidation's RuleForEach and ChildRules
57+
5058
### New in 1.5.0
5159
- Support .NET 5.0
5260

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
<Router AppAssembly="typeof(Program).Assembly">
2-
<Found Context="routeData">
3-
<RouteView RouteData="routeData" />
4-
</Found>
5-
<NotFound>
6-
<p>Sorry, there's nothing at this address.</p>
7-
</NotFound>
1+
<Router AppAssembly="@typeof(Program).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
</Found>
5+
<NotFound>
6+
<LayoutView Layout="@typeof(MainLayout)">
7+
<p>Sorry, there's nothing at this address.</p>
8+
</LayoutView>
9+
</NotFound>
810
</Router>

samples/01-DataAnnotationsValidation/DataAnnotationsValidationSample/DataAnnotationsValidationSample.csproj

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.1.0-preview4.19579.2" />
10-
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.1.0-preview4.19579.2" PrivateAssets="all" />
11-
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.1.0-preview4.19579.2" />
12-
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.1.0-preview4.19579.2" PrivateAssets="all" />
9+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
10+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.1" PrivateAssets="all" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.1" PrivateAssets="all" />
1312
</ItemGroup>
1413

1514
<ItemGroup>
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
using Microsoft.AspNetCore.Blazor.Hosting;
1+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
2+
using Microsoft.Extensions.DependencyInjection;
3+
using PeterLeslieMorris.Blazor.Validation;
4+
using System;
5+
using System.Net.Http;
6+
using System.Threading.Tasks;
27

38
namespace DataAnnotationsValidationSample
49
{
510
public class Program
611
{
7-
public static void Main(string[] args)
12+
public static async Task Main(string[] args)
813
{
9-
CreateHostBuilder(args).Build().Run();
10-
}
14+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
15+
builder.RootComponents.Add<App>("app");
16+
17+
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
18+
builder.Services.AddFormValidation(config => config.AddDataAnnotationsValidation());
1119

12-
public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
13-
BlazorWebAssemblyHost.CreateDefaultBuilder()
14-
.UseBlazorStartup<Startup>();
20+
await builder.Build().RunAsync();
21+
}
1522
}
1623
}

samples/01-DataAnnotationsValidation/DataAnnotationsValidationSample/Startup.cs

-19
This file was deleted.

samples/01-DataAnnotationsValidation/DataAnnotationsValidationSample/_Imports.razor

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
@using Microsoft.JSInterop
66
@using DataAnnotationsValidationSample
77
@using DataAnnotationsValidationSample.Components
8-
@using DataAnnotationsValidationSample.Shared
8+
@using DataAnnotationsValidationSample.Shared
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

3-
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
5-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
</PropertyGroup>
66

7-
<ItemGroup>
8-
<ProjectReference Include="..\..\..\src\PeterLeslieMorris.Blazor.FluentValidation\PeterLeslieMorris.Blazor.FluentValidation.csproj" />
9-
<ProjectReference Include="..\..\..\src\PeterLeslieMorris.Blazor.Validation\PeterLeslieMorris.Blazor.Validation.csproj" />
10-
</ItemGroup>
7+
<ItemGroup>
8+
<ProjectReference Include="..\..\..\src\PeterLeslieMorris.Blazor.FluentValidation\PeterLeslieMorris.Blazor.FluentValidation.csproj" />
9+
<ProjectReference Include="..\..\..\src\PeterLeslieMorris.Blazor.Validation\PeterLeslieMorris.Blazor.Validation.csproj" />
10+
</ItemGroup>
1111

1212
</Project>

samples/02-FluentValidation/FluentValidationSample/FluentValidators/PersonValidator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class PersonValidator : AbstractValidator<Person>
1111
public PersonValidator()
1212
{
1313
RuleFor(x => x.Salutation)
14-
.Cascade(CascadeMode.StopOnFirstFailure)
14+
.Cascade(CascadeMode.Stop)
1515
.NotEmpty()
1616
.MustAsync(LongRunningAsyncMethod).WithMessage("Cannot be DR");
1717
RuleFor(x => x.GivenName).NotEmpty();

src/Directory.Build.props

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
<PropertyGroup>
44

5-
<Version>1.6.0</Version>
6-
<AssemblyVersion>1.6.0.0</AssemblyVersion>
7-
<FileVersion>1.6.0.0</FileVersion>
5+
<Version>1.7.0</Version>
6+
<AssemblyVersion>1.7.0.0</AssemblyVersion>
7+
<FileVersion>1.7.0.0</FileVersion>
88

99
<Authors>Peter Morris</Authors>
1010
<Company />

src/PeterLeslieMorris.Blazor.FluentValidation/PeterLeslieMorris.Blazor.FluentValidation.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="FluentValidation" Version="9.0.1" />
11+
<PackageReference Include="FluentValidation" Version="10.0.4" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

src/PeterLeslieMorris.Blazor.Validation/Extensions/EditContextExtensions.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ public static bool ValidateProperty(
2929
this EditContext editContext,
3030
FieldIdentifier fieldIdentifier)
3131
{
32-
if (fieldIdentifier.Model == null)
33-
return false;
34-
3532
var propertyInfo = fieldIdentifier.Model.GetType().GetProperty(
3633
fieldIdentifier.FieldName,
3734
BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static);
@@ -89,6 +86,9 @@ private static void ValidateProperty(
8986
PropertyInfo property,
9087
HashSet<object> validatedObjects)
9188
{
89+
if (property.PropertyType.IsValueType)
90+
return;
91+
9292
NotifyPropertyChanged(editContext, instance, property.Name);
9393

9494
object value = property.GetValue(instance);

src/PeterLeslieMorris.Blazor.Validation/PeterLeslieMorris.Blazor.Validation.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
16-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.6" />
16+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.3" />
1717
</ItemGroup>
1818

1919
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">

0 commit comments

Comments
 (0)