File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 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>(
106106 {
107107 var ctor = typeInfo . GetTypeInfo ( ) . GetConstructor ( ( from sp in specProps select sp . Property . PropertyType ) . ToArray ( ) ) ;
108108 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 ( )
110111 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 (
112116 sp . Specification . DefaultValue . GetValueOrDefault (
113117 sp . Specification . ConversionType . CreateDefaultForImmutable ( ) ) ) ) . ToArray ( ) ;
114118 var immutable = ( T ) ctor . Invoke ( values ) ;
You can’t perform that action at this time.
0 commit comments