Browse Source
Support DateOnly and TimeOnly in type checks
Added DateOnly and TimeOnly to TypeHelper.IsPrimitiveExtended for .NET Core. Also updated MethodInvocationValidator to allow nulls for nullable parameter types, improving validation logic for modern .NET types.
pull/23548/head
maliming
1 year ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
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 ( decimal ) | |
type = = typeof ( DateTime ) | |
type = = typeof ( DateTime ) | |
type = = typeof ( DateTimeOffset ) | |
type = = typeof ( DateTimeOffset ) | |
#if NETCOREAPP
type = = typeof ( DateOnly ) | |
type = = typeof ( TimeOnly ) | |
#endif
type = = typeof ( TimeSpan ) | |
type = = typeof ( TimeSpan ) | |
type = = typeof ( Guid ) ;
type = = typeof ( Guid ) ;
}
}
@ -95,6 +95,7 @@ public class MethodInvocationValidator : IMethodInvocationValidator, ITransientD
{
{
var allowNulls = parameterInfo . IsOptional | |
var allowNulls = parameterInfo . IsOptional | |
parameterInfo . IsOut | |
parameterInfo . IsOut | |
TypeHelper . IsNullable ( parameterInfo . ParameterType ) | |
TypeHelper . IsPrimitiveExtended ( parameterInfo . ParameterType , includeEnums : true ) ;
TypeHelper . IsPrimitiveExtended ( parameterInfo . ParameterType , includeEnums : true ) ;
context . Errors . AddRange (
context . Errors . AddRange (