@@ -133,7 +133,7 @@ static bool HasBaseClass (ClassDeclarationSyntax classDecl)
133133 // Include property if not ignored
134134 if ( ! ignore ) {
135135 var columnName = GetColumnName ( member ) ;
136- properties . Add ( new PropertyInfo ( member . Name , member . Type . ToDisplayString ( ) , columnName , GetEnumInfo ( member ) ) ) ;
136+ properties . Add ( new PropertyInfo ( member . Name , member . Type . ToDisplayString ( ) , columnName , GetEnumInfo ( member ) ) ) ;
137137 }
138138 }
139139 }
@@ -377,16 +377,9 @@ static void Execute(
377377 sb . AppendLine ( $ " \" { property . ColumnName } \" ,") ;
378378 sb . AppendLine ( $ " (obj, stmt, index) => ") ;
379379 sb . AppendLine ( $ " {{") ;
380- sb . AppendLine ( $ " if (SQLite3.ColumnType(stmt, index) != SQLite3.ColType.Null)") ;
381- sb . AppendLine ( $ " {{") ;
382-
383- // Generate appropriate setter based on property type
384- GeneratePropertySetter ( $ "(({ fullTypeName } )obj)", sb , property ) ;
385-
386- sb . AppendLine ( $ " }}") ;
387- sb . AppendLine ( $ " }});") ;
388- sb . AppendLine ( ) ;
389- }
380+ GeneratePropertySetter ( $ "(({ fullTypeName } )obj)", sb , property ) ;
381+ sb . AppendLine ( $ " }});") ;
382+ }
390383 }
391384
392385 sb . AppendLine ( " }" ) ;
@@ -416,6 +409,11 @@ static void GeneratePropertySetter(string typedObject, StringBuilder sb, Propert
416409 if ( isNullable )
417410 propertyType = propertyType . Replace ( "?" , "" ) ;
418411
412+ if ( isNullable ) {
413+ sb . AppendLine ( $ " if (SQLite3.ColumnType(stmt, index) != SQLite3.ColType.Null)") ;
414+ sb . AppendLine ( $ " {{") ;
415+ }
416+
419417 switch ( propertyType )
420418 {
421419 case "string" :
@@ -511,6 +509,10 @@ static void GeneratePropertySetter(string typedObject, StringBuilder sb, Propert
511509
512510 break ;
513511 }
512+
513+ if ( isNullable ) {
514+ sb . AppendLine ( $ " }}") ;
515+ }
514516 }
515517
516518 record ClassInfo ( string ClassName , string Namespace , List < PropertyInfo > Properties ) ;
0 commit comments