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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
5 additions and
0 deletions
-
framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs
-
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/MethodInvocationValidator.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); |
|
|
|
} |
|
|
|
|
|
|
|
@ -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( |
|
|
|
|