Browse Source

Merge pull request #23548 from abpframework/MethodInvocationValidator-Nullable

Support DateOnly and TimeOnly in type checks
pull/23556/head
Engincan VESKE 6 months ago
committed by GitHub
parent
commit
5573a5df51
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs
  2. 1
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/MethodInvocationValidator.cs

4
framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs

@ -176,6 +176,10 @@ public static class TypeHelper
type == typeof(decimal) ||
type == typeof(DateTime) ||
type == typeof(DateTimeOffset) ||
#if NETCOREAPP
type == typeof(DateOnly) ||
type == typeof(TimeOnly) ||
#endif
type == typeof(TimeSpan) ||
type == typeof(Guid);
}

1
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/MethodInvocationValidator.cs

@ -95,6 +95,7 @@ public class MethodInvocationValidator : IMethodInvocationValidator, ITransientD
{
var allowNulls = parameterInfo.IsOptional ||
parameterInfo.IsOut ||
TypeHelper.IsNullable(parameterInfo.ParameterType) ||
TypeHelper.IsPrimitiveExtended(parameterInfo.ParameterType, includeEnums: true);
context.Errors.AddRange(

Loading…
Cancel
Save