File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -106,9 +106,13 @@ public static ParserResult<T> Build<T>(
106
106
{
107
107
var ctor = typeInfo . GetTypeInfo ( ) . GetConstructor ( ( from sp in specProps select sp . Property . PropertyType ) . ToArray ( ) ) ;
108
108
var values = ( from prms in ctor . GetParameters ( )
109
- join sp in specPropsWithValue on prms . Name . ToLower ( ) equals sp . Property . Name . ToLower ( )
109
+ join sp in specPropsWithValue on prms . Name . ToLower ( ) equals sp . Property . Name . ToLower ( ) into spv
110
+ from sp in spv . DefaultIfEmpty ( )
110
111
select
111
- sp . Value . GetValueOrDefault (
112
+ sp == null
113
+ ? specProps . First ( s => String . Equals ( s . Property . Name , prms . Name , StringComparison . CurrentCultureIgnoreCase ) )
114
+ . Property . PropertyType . GetDefaultValue ( )
115
+ : sp . Value . GetValueOrDefault (
112
116
sp . Specification . DefaultValue . GetValueOrDefault (
113
117
sp . Specification . ConversionType . CreateDefaultForImmutable ( ) ) ) ) . ToArray ( ) ;
114
118
var immutable = ( T ) ctor . Invoke ( values ) ;
You can’t perform that action at this time.
0 commit comments