File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
src/JsonApiDotNetCore/Models Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 11using System ;
22using System . Reflection ;
3+ using JsonApiDotNetCore . Internal ;
34
45namespace JsonApiDotNetCore . Models
56{
@@ -27,14 +28,12 @@ public void SetValue(object entity, object newValue)
2728 . GetType ( )
2829 . GetProperty ( InternalAttributeName ) ;
2930
30- if ( propertyInfo != null )
31- {
32- Type t = Nullable . GetUnderlyingType ( propertyInfo . PropertyType ) ?? propertyInfo . PropertyType ;
31+ if ( propertyInfo != null )
32+ {
33+ var convertedValue = TypeHelper . ConvertType ( newValue , propertyInfo . PropertyType ) ;
3334
34- var convertedValue = ( newValue == null ) ? null : Convert . ChangeType ( newValue , t ) ;
35-
36- propertyInfo . SetValue ( entity , convertedValue , null ) ;
37- }
35+ propertyInfo . SetValue ( entity , convertedValue ) ;
36+ }
3837 }
3938 }
4039}
You can’t perform that action at this time.
0 commit comments