@@ -1427,17 +1427,102 @@ public class PropertyModifier
1427
1427
public const string AccessModifierKey = "accessModifier" ;
1428
1428
public const string InjectXmlUnmarshallCodeKey = "injectXmlUnmarshallCode" ;
1429
1429
public const string SkipContextTestExpressionUnmarshallingLogicKey = "skipContextTestExpressionUnmarshallingLogic" ;
1430
+ public const string InjectXmlIsSetCodeKey = "injectXmlIsSet" ;
1431
+ public const string InjectXmlPrivateMemberAssignmentKey = "injectXmlPrivateMemberAssignment" ;
1432
+ public const string InjectXmlPropertyGetterKey = "injectXmlPropertyGetter" ;
1433
+ public const string InjectXmlPropertySetterKey = "injectXmlPropertySetter" ;
1434
+ public const string SkipSetterKey = "skipSetter" ;
1435
+
1436
+
1430
1437
1431
1438
private readonly string _modelPropertyName ;
1432
1439
private readonly JsonData _modifierData ;
1433
1440
private readonly HashSet < string > _injectXmlUnmarshallCode ;
1441
+ private readonly HashSet < string > _injectXmlIsSetCode ;
1442
+ private readonly HashSet < string > _injectXmlPrivateMemberAssignment ;
1443
+ private readonly HashSet < string > _injectXmlPropertyGetter ;
1444
+ private readonly HashSet < string > _injectedXmlPropertySetter ;
1445
+ private readonly bool _skipSetter ;
1446
+
1434
1447
internal PropertyModifier ( string modelPropertyName , JsonData modifierData )
1435
1448
{
1436
1449
this . _modelPropertyName = modelPropertyName ;
1437
1450
this . _modifierData = modifierData ;
1438
1451
_injectXmlUnmarshallCode = ParseInjectXmlUnmarshallCode ( ) ;
1452
+ _injectXmlIsSetCode = ParseInjectXmlIsSetCode ( ) ;
1453
+ _injectXmlPrivateMemberAssignment = ParseInjectXmlPrivateMemberAssignment ( ) ;
1454
+ _injectXmlPropertyGetter = ParseInjectXmlGetter ( ) ;
1455
+ _injectedXmlPropertySetter = ParseInjectXmlPropertySetter ( ) ;
1456
+ _skipSetter = ParseXmlSkipSetter ( ) ;
1457
+ }
1458
+
1459
+ private bool ParseXmlSkipSetter ( )
1460
+ {
1461
+ var data = _modifierData [ SkipSetterKey ] ;
1462
+ return data != null && data . IsBoolean ? ( bool ) data : false ;
1463
+
1464
+ }
1465
+
1466
+ public bool SkipSetter { get { return _skipSetter ; } }
1467
+
1468
+ private HashSet < string > ParseInjectXmlPropertySetter ( )
1469
+ {
1470
+ var data = _modifierData [ InjectXmlPropertySetterKey ] ? . Cast < object > ( )
1471
+ . Select ( x => x . ToString ( ) ) ;
1472
+
1473
+ return new HashSet < string > ( data ?? new string [ 0 ] ) ;
1439
1474
}
1440
1475
1476
+ /// <summary>
1477
+ /// Use this customization within a property modifier to inject code in the Setter for a property.
1478
+ /// If this HashSet has values then the default setter will not be generated and this custom injected
1479
+ /// code will be used instead.
1480
+ /// </summary>
1481
+ public HashSet < string > InjectXmlPropertySetter { get { return _injectedXmlPropertySetter ; } }
1482
+
1483
+ private HashSet < string > ParseInjectXmlGetter ( )
1484
+ {
1485
+ var data = _modifierData [ InjectXmlPropertyGetterKey ] ? . Cast < object > ( )
1486
+ . Select ( x => x . ToString ( ) ) ;
1487
+
1488
+ return new HashSet < string > ( data ?? new string [ 0 ] ) ;
1489
+ }
1490
+
1491
+ /// <summary>
1492
+ /// Use this customization within a property modifier to inject code in the getter for a property.
1493
+ /// If this HashSet has values then the default getter will not be generated and this custom injected
1494
+ /// code will be used instead.
1495
+ /// </summary>
1496
+ public HashSet < string > InjectXmlPropertyGetter { get { return _injectXmlPropertyGetter ; } }
1497
+
1498
+ private HashSet < string > ParseInjectXmlPrivateMemberAssignment ( )
1499
+ {
1500
+ var data = _modifierData [ InjectXmlPrivateMemberAssignmentKey ] ? . Cast < object > ( )
1501
+ . Select ( x => x . ToString ( ) ) ;
1502
+
1503
+ return new HashSet < string > ( data ?? new string [ 0 ] ) ;
1504
+ }
1505
+
1506
+ /// <summary>
1507
+ /// Use this customization within a property modifier to inject code in the private member assignment
1508
+ /// for a property. If this HashSet has values then the default private member assignment will not be generated
1509
+ /// and this custom injected code will be used instead.
1510
+ /// </summary>
1511
+ public HashSet < string > InjectXmlPrivateMemberAssignment { get { return _injectXmlPrivateMemberAssignment ; } }
1512
+
1513
+ private HashSet < string > ParseInjectXmlIsSetCode ( )
1514
+ {
1515
+ var data = _modifierData [ InjectXmlIsSetCodeKey ] ? . Cast < object > ( )
1516
+ . Select ( x => x . ToString ( ) ) ;
1517
+
1518
+ return new HashSet < string > ( data ?? new string [ 0 ] ) ;
1519
+ }
1520
+
1521
+ /// <summary>
1522
+ /// Use this customization within a property modifier to inject code in the IsSet() method for a property
1523
+ /// If this HashSet has values then the default IsSet() code will not be generated and this custom injected code will be used instead.
1524
+ /// </summary>
1525
+ public HashSet < string > InjectXmlIsSetCode { get { return _injectXmlIsSetCode ; } }
1441
1526
/// <summary>
1442
1527
/// Returns the original property name of the renamed property
1443
1528
/// </summary>
0 commit comments