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 1
1
using System ;
2
2
using System . Reflection ;
3
+ using JsonApiDotNetCore . Internal ;
3
4
4
5
namespace JsonApiDotNetCore . Models
5
6
{
@@ -27,14 +28,12 @@ public void SetValue(object entity, object newValue)
27
28
. GetType ( )
28
29
. GetProperty ( InternalAttributeName ) ;
29
30
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 ) ;
33
34
34
- var convertedValue = ( newValue == null ) ? null : Convert . ChangeType ( newValue , t ) ;
35
-
36
- propertyInfo . SetValue ( entity , convertedValue , null ) ;
37
- }
35
+ propertyInfo . SetValue ( entity , convertedValue ) ;
36
+ }
38
37
}
39
38
}
40
39
}
You can’t perform that action at this time.
0 commit comments