Skip to content

Commit 713d9fc

Browse files
[Update] POCO generator to initialize List<T> properties
1 parent e921491 commit 713d9fc

203 files changed

Lines changed: 630 additions & 623 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPoco/AnnotatingElement.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public partial class AnnotatingElement : IAnnotatingElement
5353
/// </summary>
5454
[Property(xmiId: "_19_0_2_12e503d9_1594312532679_496267_4310", aggregation: AggregationKind.None, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
5555
[Implements(implementation: "IElement.AliasIds")]
56-
public List<string> AliasIds { get; set; }
56+
public List<string> AliasIds { get; set; } = [];
5757

5858
/// <summary>
5959
/// The Elements that are annotated by this AnnotatingElement. If annotation is not empty, these are the
@@ -193,7 +193,7 @@ public List<IElement> QueryOwnedElement()
193193
[Property(xmiId: "_18_5_3_12e503d9_1543092026091_217766_16748", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
194194
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
195195
[Implements(implementation: "IElement.OwnedRelationship")]
196-
public List<IRelationship> OwnedRelationship { get; set; }
196+
public List<IRelationship> OwnedRelationship { get; set; } = [];
197197

198198
/// <summary>
199199
/// The owner of this Element, derived as the owningRelatedElement of the owningRelationship of this

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPoco/Association.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public partial class Association : IAssociation
5757
/// </summary>
5858
[Property(xmiId: "_19_0_2_12e503d9_1594312532679_496267_4310", aggregation: AggregationKind.None, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
5959
[Implements(implementation: "IElement.AliasIds")]
60-
public List<string> AliasIds { get; set; }
60+
public List<string> AliasIds { get; set; } = [];
6161

6262
/// <summary>
6363
/// The features of the Association that identify the things that can be related by it. A concrete
@@ -505,15 +505,15 @@ public List<IMembership> QueryOwnedMembership()
505505
[Property(xmiId: "_18_5_3_12e503d9_1533160674986_59873_43302", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
506506
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
507507
[Implements(implementation: "IRelationship.OwnedRelatedElement")]
508-
public List<IElement> OwnedRelatedElement { get; set; }
508+
public List<IElement> OwnedRelatedElement { get; set; } = [];
509509

510510
/// <summary>
511511
/// The Relationships for which this Element is the owningRelatedElement.
512512
/// </summary>
513513
[Property(xmiId: "_18_5_3_12e503d9_1543092026091_217766_16748", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
514514
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
515515
[Implements(implementation: "IElement.OwnedRelationship")]
516-
public List<IRelationship> OwnedRelationship { get; set; }
516+
public List<IRelationship> OwnedRelationship { get; set; } = [];
517517

518518
/// <summary>
519519
/// The ownedRelationships of this Type that are Specializations, for which the Type is the specific
@@ -662,7 +662,7 @@ public string QueryShortName()
662662
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
663663
[RedefinedByProperty("IAssociation.SourceType")]
664664
[Implements(implementation: "IRelationship.Source")]
665-
public List<IElement> Source { get; set; }
665+
public List<IElement> Source { get; set; } = [];
666666

667667
/// <summary>
668668
/// The source relatedType for this Association. It is the first relatedType of the Association.
@@ -683,7 +683,7 @@ public IType QuerySourceType()
683683
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
684684
[RedefinedByProperty("IAssociation.TargetType")]
685685
[Implements(implementation: "IRelationship.Target")]
686-
public List<IElement> Target { get; set; }
686+
public List<IElement> Target { get; set; } = [];
687687

688688
/// <summary>
689689
/// The target relatedTypes for this Association. This includes all the relatedTypes other than the

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPoco/Dependency.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ public partial class Dependency : IDependency
5555
/// </summary>
5656
[Property(xmiId: "_19_0_2_12e503d9_1594312532679_496267_4310", aggregation: AggregationKind.None, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
5757
[Implements(implementation: "IElement.AliasIds")]
58-
public List<string> AliasIds { get; set; }
58+
public List<string> AliasIds { get; set; } = [];
5959

6060
/// <summary>
6161
/// The Element or Elements dependent on the supplier Elements.
6262
/// </summary>
6363
[Property(xmiId: "_19_0_2_12e503d9_1594006406653_175551_182", aggregation: AggregationKind.None, lowerValue: 1, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
6464
[RedefinedProperty(propertyName: "_18_5_3_12e503d9_1533160674971_696758_43228")]
6565
[Implements(implementation: "IDependency.Client")]
66-
public List<IElement> Client { get; set; }
66+
public List<IElement> Client { get; set; } = [];
6767

6868
/// <summary>
6969
/// The declared name of this Element.
@@ -174,15 +174,15 @@ public List<IElement> QueryOwnedElement()
174174
[Property(xmiId: "_18_5_3_12e503d9_1533160674986_59873_43302", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
175175
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
176176
[Implements(implementation: "IRelationship.OwnedRelatedElement")]
177-
public List<IElement> OwnedRelatedElement { get; set; }
177+
public List<IElement> OwnedRelatedElement { get; set; } = [];
178178

179179
/// <summary>
180180
/// The Relationships for which this Element is the owningRelatedElement.
181181
/// </summary>
182182
[Property(xmiId: "_18_5_3_12e503d9_1543092026091_217766_16748", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
183183
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
184184
[Implements(implementation: "IElement.OwnedRelationship")]
185-
public List<IRelationship> OwnedRelationship { get; set; }
185+
public List<IRelationship> OwnedRelationship { get; set; } = [];
186186

187187
/// <summary>
188188
/// The owner of this Element, derived as the owningRelatedElement of the owningRelationship of this
@@ -281,15 +281,15 @@ public string QueryShortName()
281281
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
282282
[RedefinedByProperty("IDependency.Client")]
283283
[Implements(implementation: "IRelationship.Source")]
284-
public List<IElement> Source { get; set; }
284+
public List<IElement> Source { get; set; } = [];
285285

286286
/// <summary>
287287
/// The Element or Elements on which the client Elements depend in some respect.
288288
/// </summary>
289289
[Property(xmiId: "_19_0_2_12e503d9_1594006525044_548771_207", aggregation: AggregationKind.None, lowerValue: 1, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
290290
[RedefinedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_138197_43179")]
291291
[Implements(implementation: "IDependency.Supplier")]
292-
public List<IElement> Supplier { get; set; }
292+
public List<IElement> Supplier { get; set; } = [];
293293

294294
/// <summary>
295295
/// The relatedElements to which this Relationship is considered to be directed.
@@ -298,7 +298,7 @@ public string QueryShortName()
298298
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
299299
[RedefinedByProperty("IDependency.Supplier")]
300300
[Implements(implementation: "IRelationship.Target")]
301-
public List<IElement> Target { get; set; }
301+
public List<IElement> Target { get; set; } = [];
302302

303303
/// <summary>
304304
/// The TextualRepresentations that annotate this Element.

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPoco/EnumerationDefinition.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public partial class EnumerationDefinition : IEnumerationDefinition
7878
/// </summary>
7979
[Property(xmiId: "_19_0_2_12e503d9_1594312532679_496267_4310", aggregation: AggregationKind.None, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
8080
[Implements(implementation: "IElement.AliasIds")]
81-
public List<string> AliasIds { get; set; }
81+
public List<string> AliasIds { get; set; } = [];
8282

8383
/// <summary>
8484
/// The declared name of this Element.
@@ -746,7 +746,7 @@ public List<IReferenceUsage> QueryOwnedReference()
746746
[Property(xmiId: "_18_5_3_12e503d9_1543092026091_217766_16748", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
747747
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
748748
[Implements(implementation: "IElement.OwnedRelationship")]
749-
public List<IRelationship> OwnedRelationship { get; set; }
749+
public List<IRelationship> OwnedRelationship { get; set; } = [];
750750

751751
/// <summary>
752752
/// The RenderingUsages that are ownedUsages of this Definition.

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPoco/Feature.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public partial class Feature : IFeature
6868
/// </summary>
6969
[Property(xmiId: "_19_0_2_12e503d9_1594312532679_496267_4310", aggregation: AggregationKind.None, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
7070
[Implements(implementation: "IElement.AliasIds")]
71-
public List<string> AliasIds { get; set; }
71+
public List<string> AliasIds { get; set; } = [];
7272

7373
/// <summary>
7474
/// The Feature that are chained together to determine the values of this Feature, derived from the
@@ -696,7 +696,7 @@ public IReferenceSubsetting QueryOwnedReferenceSubsetting()
696696
[Property(xmiId: "_18_5_3_12e503d9_1543092026091_217766_16748", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
697697
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
698698
[Implements(implementation: "IElement.OwnedRelationship")]
699-
public List<IRelationship> OwnedRelationship { get; set; }
699+
public List<IRelationship> OwnedRelationship { get; set; } = [];
700700

701701
/// <summary>
702702
/// The ownedRelationships of this Type that are Specializations, for which the Type is the specific

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPoco/FeatureTyping.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public partial class FeatureTyping : IFeatureTyping
5656
/// </summary>
5757
[Property(xmiId: "_19_0_2_12e503d9_1594312532679_496267_4310", aggregation: AggregationKind.None, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
5858
[Implements(implementation: "IElement.AliasIds")]
59-
public List<string> AliasIds { get; set; }
59+
public List<string> AliasIds { get; set; } = [];
6060

6161
/// <summary>
6262
/// The declared name of this Element.
@@ -176,15 +176,15 @@ public List<IElement> QueryOwnedElement()
176176
[Property(xmiId: "_18_5_3_12e503d9_1533160674986_59873_43302", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
177177
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
178178
[Implements(implementation: "IRelationship.OwnedRelatedElement")]
179-
public List<IElement> OwnedRelatedElement { get; set; }
179+
public List<IElement> OwnedRelatedElement { get; set; } = [];
180180

181181
/// <summary>
182182
/// The Relationships for which this Element is the owningRelatedElement.
183183
/// </summary>
184184
[Property(xmiId: "_18_5_3_12e503d9_1543092026091_217766_16748", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
185185
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
186186
[Implements(implementation: "IElement.OwnedRelationship")]
187-
public List<IRelationship> OwnedRelationship { get; set; }
187+
public List<IRelationship> OwnedRelationship { get; set; } = [];
188188

189189
/// <summary>
190190
/// The owner of this Element, derived as the owningRelatedElement of the owningRelationship of this
@@ -308,7 +308,7 @@ public string QueryShortName()
308308
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
309309
[RedefinedByProperty("ISpecialization.Specific")]
310310
[Implements(implementation: "IRelationship.Source")]
311-
public List<IElement> Source { get; set; }
311+
public List<IElement> Source { get; set; } = [];
312312

313313
/// <summary>
314314
/// A Type with a subset of all instances of the general Type, which might be the same set.
@@ -326,7 +326,7 @@ public string QueryShortName()
326326
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
327327
[RedefinedByProperty("ISpecialization.General")]
328328
[Implements(implementation: "IRelationship.Target")]
329-
public List<IElement> Target { get; set; }
329+
public List<IElement> Target { get; set; } = [];
330330

331331
/// <summary>
332332
/// The TextualRepresentations that annotate this Element.

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPoco/Flow.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public partial class Flow : IFlow
6060
/// </summary>
6161
[Property(xmiId: "_19_0_2_12e503d9_1594312532679_496267_4310", aggregation: AggregationKind.None, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
6262
[Implements(implementation: "IElement.AliasIds")]
63-
public List<string> AliasIds { get; set; }
63+
public List<string> AliasIds { get; set; } = [];
6464

6565
/// <summary>
6666
/// The Associations that type the Connector.
@@ -771,15 +771,15 @@ public IReferenceSubsetting QueryOwnedReferenceSubsetting()
771771
[Property(xmiId: "_18_5_3_12e503d9_1533160674986_59873_43302", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
772772
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
773773
[Implements(implementation: "IRelationship.OwnedRelatedElement")]
774-
public List<IElement> OwnedRelatedElement { get; set; }
774+
public List<IElement> OwnedRelatedElement { get; set; } = [];
775775

776776
/// <summary>
777777
/// The Relationships for which this Element is the owningRelatedElement.
778778
/// </summary>
779779
[Property(xmiId: "_18_5_3_12e503d9_1543092026091_217766_16748", aggregation: AggregationKind.Composite, lowerValue: 0, upperValue: int.MaxValue, isOrdered: true, isReadOnly: false, isDerived: false, isDerivedUnion: false, isUnique: true, defaultValue: null)]
780780
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_585972_43176")]
781781
[Implements(implementation: "IElement.OwnedRelationship")]
782-
public List<IRelationship> OwnedRelationship { get; set; }
782+
public List<IRelationship> OwnedRelationship { get; set; } = [];
783783

784784
/// <summary>
785785
/// The ownedRelationships of this Type that are Specializations, for which the Type is the specific
@@ -1012,7 +1012,7 @@ public string QueryShortName()
10121012
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
10131013
[RedefinedByProperty("IConnector.SourceFeature")]
10141014
[Implements(implementation: "IRelationship.Source")]
1015-
public List<IElement> Source { get; set; }
1015+
public List<IElement> Source { get; set; } = [];
10161016

10171017
/// <summary>
10181018
/// The source relatedFeature for this Connector. It is the first relatedFeature.
@@ -1044,7 +1044,7 @@ public IFeature QuerySourceOutputFeature()
10441044
[SubsettedProperty(propertyName: "_18_5_3_12e503d9_1533160674961_132339_43177")]
10451045
[RedefinedByProperty("IConnector.TargetFeature")]
10461046
[Implements(implementation: "IRelationship.Target")]
1047-
public List<IElement> Target { get; set; }
1047+
public List<IElement> Target { get; set; } = [];
10481048

10491049
/// <summary>
10501050
/// The target relatedFeatures for this Connector. This includes all the relatedFeatures other than the

0 commit comments

Comments
 (0)