Skip to content

Commit

Permalink
Merge pull request #35 from mrpmorris/release/1.7
Browse files Browse the repository at this point in the history
Release/1.7
  • Loading branch information
mrpmorris authored May 1, 2021
2 parents 8edf091 + 960b1e2 commit cac4431
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 54 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ More sample projects will be added as the framework develops.
- [FluentValidation Sample]- Shows how to use the [FluentValidation.com] library to validate.

## What's new

### 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)

### New in 1.6.0
- Suport FluentValidation's RuleForEach and ChildRules

### New in 1.5.0
- Support .NET 5.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<Router AppAssembly="typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="routeData" />
</Found>
<NotFound>
<p>Sorry, there's nothing at this address.</p>
</NotFound>
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.1.0-preview4.19579.2" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.1.0-preview4.19579.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.1.0-preview4.19579.2" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.1.0-preview4.19579.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.1" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
using Microsoft.AspNetCore.Blazor.Hosting;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.DependencyInjection;
using PeterLeslieMorris.Blazor.Validation;
using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace DataAnnotationsValidationSample
{
public class Program
{
public static void Main(string[] args)
public static async Task Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddFormValidation(config => config.AddDataAnnotationsValidation());

public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
BlazorWebAssemblyHost.CreateDefaultBuilder()
.UseBlazorStartup<Startup>();
await builder.Build().RunAsync();
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
@using Microsoft.JSInterop
@using DataAnnotationsValidationSample
@using DataAnnotationsValidationSample.Components
@using DataAnnotationsValidationSample.Shared
@using DataAnnotationsValidationSample.Shared
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

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

<ItemGroup>
<ProjectReference Include="..\..\..\src\PeterLeslieMorris.Blazor.FluentValidation\PeterLeslieMorris.Blazor.FluentValidation.csproj" />
<ProjectReference Include="..\..\..\src\PeterLeslieMorris.Blazor.Validation\PeterLeslieMorris.Blazor.Validation.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\PeterLeslieMorris.Blazor.FluentValidation\PeterLeslieMorris.Blazor.FluentValidation.csproj" />
<ProjectReference Include="..\..\..\src\PeterLeslieMorris.Blazor.Validation\PeterLeslieMorris.Blazor.Validation.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class PersonValidator : AbstractValidator<Person>
public PersonValidator()
{
RuleFor(x => x.Salutation)
.Cascade(CascadeMode.StopOnFirstFailure)
.Cascade(CascadeMode.Stop)
.NotEmpty()
.MustAsync(LongRunningAsyncMethod).WithMessage("Cannot be DR");
RuleFor(x => x.GivenName).NotEmpty();
Expand Down
6 changes: 3 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>

<Version>1.6.0</Version>
<AssemblyVersion>1.6.0.0</AssemblyVersion>
<FileVersion>1.6.0.0</FileVersion>
<Version>1.7.0</Version>
<AssemblyVersion>1.7.0.0</AssemblyVersion>
<FileVersion>1.7.0.0</FileVersion>

<Authors>Peter Morris</Authors>
<Company />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

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

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ public static bool ValidateProperty(
this EditContext editContext,
FieldIdentifier fieldIdentifier)
{
if (fieldIdentifier.Model == null)
return false;

var propertyInfo = fieldIdentifier.Model.GetType().GetProperty(
fieldIdentifier.FieldName,
BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static);
Expand Down Expand Up @@ -89,6 +86,9 @@ private static void ValidateProperty(
PropertyInfo property,
HashSet<object> validatedObjects)
{
if (property.PropertyType.IsValueType)
return;

NotifyPropertyChanged(editContext, instance, property.Name);

object value = property.GetValue(instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

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

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

0 comments on commit cac4431

Please sign in to comment.