Skip to content

Commit b71e81a

Browse files
Fix #278: DAL extensions target interface types
1 parent 48919df commit b71e81a

25 files changed

Lines changed: 43 additions & 55 deletions

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPocoExtension/FeatureTypingExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public static void UpdateReferenceProperties(this Core.POCO.Core.Features.Featur
176176

177177
if (cache.TryGetValue(dto.Type, out lazyPoco))
178178
{
179-
poco.Type = (Core.POCO.Core.Types.Type)lazyPoco.Value;
179+
poco.Type = (Core.POCO.Core.Types.IType)lazyPoco.Value;
180180
}
181181
else
182182
{
@@ -185,7 +185,7 @@ public static void UpdateReferenceProperties(this Core.POCO.Core.Features.Featur
185185

186186
if (cache.TryGetValue(dto.TypedFeature, out lazyPoco))
187187
{
188-
poco.TypedFeature = (Core.POCO.Core.Features.Feature)lazyPoco.Value;
188+
poco.TypedFeature = (Core.POCO.Core.Features.IFeature)lazyPoco.Value;
189189
}
190190
else
191191
{

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPocoExtension/ReferenceSubsettingExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public static void UpdateReferenceProperties(this Core.POCO.Core.Features.Refere
176176

177177
if (cache.TryGetValue(dto.ReferencedFeature, out lazyPoco))
178178
{
179-
poco.ReferencedFeature = (Core.POCO.Core.Features.Feature)lazyPoco.Value;
179+
poco.ReferencedFeature = (Core.POCO.Core.Features.IFeature)lazyPoco.Value;
180180
}
181181
else
182182
{

SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenPocoExtension/SubclassificationExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public static void UpdateReferenceProperties(this Core.POCO.Core.Classifiers.Sub
176176

177177
if (cache.TryGetValue(dto.Subclassifier, out lazyPoco))
178178
{
179-
poco.Subclassifier = (Core.POCO.Core.Classifiers.Classifier)lazyPoco.Value;
179+
poco.Subclassifier = (Core.POCO.Core.Classifiers.IClassifier)lazyPoco.Value;
180180
}
181181
else
182182
{
@@ -185,7 +185,7 @@ public static void UpdateReferenceProperties(this Core.POCO.Core.Classifiers.Sub
185185

186186
if (cache.TryGetValue(dto.Superclassifier, out lazyPoco))
187187
{
188-
poco.Superclassifier = (Core.POCO.Core.Classifiers.Classifier)lazyPoco.Value;
188+
poco.Superclassifier = (Core.POCO.Core.Classifiers.IClassifier)lazyPoco.Value;
189189
}
190190
else
191191
{

SysML2.NET.CodeGenerator/Templates/Uml/core-dal-poco-uml-extensions.hbs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,14 @@ namespace SysML2.NET.Dal
154154
{{#if property.IsComposite}}
155155
{{#if (Property.IsOfTypeBaseElement property)}}
156156
((IContained{{property.Owner.Name}})poco).{{ String.PascalCase property.Name}}.Add(lazyPoco.Value);
157-
{{else if property.Type.IsAbstract }}
158-
((IContained{{property.Owner.Name}})poco).{{ String.PascalCase property.Name}}.Add((Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.I{{ property.Type.Name }})lazyPoco.Value);
159157
{{else}}
160-
((IContained{{property.Owner.Name}})poco).{{ String.PascalCase property.Name}}.Add((Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.{{ property.Type.Name }})lazyPoco.Value);
158+
((IContained{{property.Owner.Name}})poco).{{ String.PascalCase property.Name}}.Add((Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.I{{ property.Type.Name }})lazyPoco.Value);
161159
{{/if}}
162160
{{else}}
163161
{{#if (Property.IsOfTypeBaseElement property)}}
164162
poco.{{ String.PascalCase property.Name}}.Add(lazyPoco.Value);
165-
{{else if property.Type.IsAbstract }}
166-
poco.{{ String.PascalCase property.Name}}.Add((Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.I{{ property.Type.Name }})lazyPoco.Value);
167163
{{else}}
168-
poco.{{ String.PascalCase property.Name}}.Add((Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.{{ property.Type.Name }})lazyPoco.Value);
164+
poco.{{ String.PascalCase property.Name}}.Add((Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.I{{ property.Type.Name }})lazyPoco.Value);
169165
{{/if}}
170166
{{/if}}
171167
}
@@ -177,18 +173,14 @@ namespace SysML2.NET.Dal
177173
{{#if property.Opposite.IsComposite}}
178174
{{#if (Property.IsOfTypeBaseElement property)}}
179175
((IContained{{property.Owner.Name}})poco).{{ String.PascalCase property.Name}} = lazyPoco.Value;
180-
{{else if property.Type.IsAbstract }}
181-
((IContained{{property.Owner.Name}})poco).{{ String.PascalCase property.Name}} = (Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.I{{ property.Type.Name }})lazyPoco.Value;
182176
{{else}}
183-
((IContained{{property.Owner.Name}})poco).{{ String.PascalCase property.Name}} = (Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.{{ property.Type.Name }})lazyPoco.Value;
177+
((IContained{{property.Owner.Name}})poco).{{ String.PascalCase property.Name}} = (Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.I{{ property.Type.Name }})lazyPoco.Value;
184178
{{/if}}
185179
{{else}}
186180
{{#if (Property.IsOfTypeBaseElement property)}}
187181
poco.{{ String.PascalCase property.Name}} = lazyPoco.Value;
188-
{{else if property.Type.IsAbstract }}
189-
poco.{{ String.PascalCase property.Name}} = (Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.I{{ property.Type.Name }})lazyPoco.Value;
190182
{{else}}
191-
poco.{{ String.PascalCase property.Name}} = (Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.{{ property.Type.Name }})lazyPoco.Value;
183+
poco.{{ String.PascalCase property.Name}} = (Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.I{{ property.Type.Name }})lazyPoco.Value;
192184
{{/if}}
193185
{{/if}}
194186
}
@@ -207,18 +199,14 @@ namespace SysML2.NET.Dal
207199
{{#if property.Opposite.IsComposite}}
208200
{{#if (Property.IsOfTypeBaseElement property)}}
209201
((IContained{{property.Owner.Name}})poco).{{ String.PascalCase property.Name}} = lazyPoco.Value;
210-
{{else if property.Type.IsAbstract }}
211-
((IContained{{property.Owner.Name}})poco).{{ String.PascalCase property.Name}} = (Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.I{{ property.Type.Name }})lazyPoco.Value;
212202
{{else}}
213-
((IContained{{property.Owner.Name}})poco).{{ String.PascalCase property.Name}} = (Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.{{ property.Type.Name }})lazyPoco.Value;
203+
((IContained{{property.Owner.Name}})poco).{{ String.PascalCase property.Name}} = (Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.I{{ property.Type.Name }})lazyPoco.Value;
214204
{{/if}}
215205
{{else}}
216206
{{#if (Property.IsOfTypeBaseElement property)}}
217207
poco.{{ String.PascalCase property.Name}} = lazyPoco.Value;
218-
{{else if property.Type.IsAbstract }}
219-
poco.{{ String.PascalCase property.Name}} = (Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.I{{ property.Type.Name }})lazyPoco.Value;
220208
{{else}}
221-
poco.{{ String.PascalCase property.Name}} = (Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.{{ property.Type.Name }})lazyPoco.Value;
209+
poco.{{ String.PascalCase property.Name}} = (Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace property.Type }}.I{{ property.Type.Name }})lazyPoco.Value;
222210
{{/if}}
223211
{{/if}}
224212
}

SysML2.NET.Dal/Core/AutoGenPocoExtension/ConjugatedPortTypingExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public static void UpdateReferenceProperties(this Core.POCO.Systems.Ports.Conjug
138138

139139
if (cache.TryGetValue(dto.ConjugatedPortDefinition, out lazyPoco))
140140
{
141-
poco.ConjugatedPortDefinition = (Core.POCO.Systems.Ports.ConjugatedPortDefinition)lazyPoco.Value;
141+
poco.ConjugatedPortDefinition = (Core.POCO.Systems.Ports.IConjugatedPortDefinition)lazyPoco.Value;
142142
}
143143
else
144144
{
@@ -185,7 +185,7 @@ public static void UpdateReferenceProperties(this Core.POCO.Systems.Ports.Conjug
185185

186186
if (cache.TryGetValue(dto.TypedFeature, out lazyPoco))
187187
{
188-
poco.TypedFeature = (Core.POCO.Core.Features.Feature)lazyPoco.Value;
188+
poco.TypedFeature = (Core.POCO.Core.Features.IFeature)lazyPoco.Value;
189189
}
190190
else
191191
{

SysML2.NET.Dal/Core/AutoGenPocoExtension/ConjugationExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public static void UpdateReferenceProperties(this Core.POCO.Core.Types.Conjugati
138138

139139
if (cache.TryGetValue(dto.ConjugatedType, out lazyPoco))
140140
{
141-
poco.ConjugatedType = (Core.POCO.Core.Types.Type)lazyPoco.Value;
141+
poco.ConjugatedType = (Core.POCO.Core.Types.IType)lazyPoco.Value;
142142
}
143143
else
144144
{
@@ -147,7 +147,7 @@ public static void UpdateReferenceProperties(this Core.POCO.Core.Types.Conjugati
147147

148148
if (cache.TryGetValue(dto.OriginalType, out lazyPoco))
149149
{
150-
poco.OriginalType = (Core.POCO.Core.Types.Type)lazyPoco.Value;
150+
poco.OriginalType = (Core.POCO.Core.Types.IType)lazyPoco.Value;
151151
}
152152
else
153153
{

SysML2.NET.Dal/Core/AutoGenPocoExtension/CrossSubsettingExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public static void UpdateReferenceProperties(this Core.POCO.Core.Features.CrossS
138138

139139
if (cache.TryGetValue(dto.CrossedFeature, out lazyPoco))
140140
{
141-
poco.CrossedFeature = (Core.POCO.Core.Features.Feature)lazyPoco.Value;
141+
poco.CrossedFeature = (Core.POCO.Core.Features.IFeature)lazyPoco.Value;
142142
}
143143
else
144144
{

SysML2.NET.Dal/Core/AutoGenPocoExtension/DifferencingExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public static void UpdateReferenceProperties(this Core.POCO.Core.Types.Differenc
138138

139139
if (cache.TryGetValue(dto.DifferencingType, out lazyPoco))
140140
{
141-
poco.DifferencingType = (Core.POCO.Core.Types.Type)lazyPoco.Value;
141+
poco.DifferencingType = (Core.POCO.Core.Types.IType)lazyPoco.Value;
142142
}
143143
else
144144
{

SysML2.NET.Dal/Core/AutoGenPocoExtension/DisjoiningExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public static void UpdateReferenceProperties(this Core.POCO.Core.Types.Disjoinin
138138

139139
if (cache.TryGetValue(dto.DisjoiningType, out lazyPoco))
140140
{
141-
poco.DisjoiningType = (Core.POCO.Core.Types.Type)lazyPoco.Value;
141+
poco.DisjoiningType = (Core.POCO.Core.Types.IType)lazyPoco.Value;
142142
}
143143
else
144144
{
@@ -185,7 +185,7 @@ public static void UpdateReferenceProperties(this Core.POCO.Core.Types.Disjoinin
185185

186186
if (cache.TryGetValue(dto.TypeDisjoined, out lazyPoco))
187187
{
188-
poco.TypeDisjoined = (Core.POCO.Core.Types.Type)lazyPoco.Value;
188+
poco.TypeDisjoined = (Core.POCO.Core.Types.IType)lazyPoco.Value;
189189
}
190190
else
191191
{

SysML2.NET.Dal/Core/AutoGenPocoExtension/FeatureChainingExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public static void UpdateReferenceProperties(this Core.POCO.Core.Features.Featur
138138

139139
if (cache.TryGetValue(dto.ChainingFeature, out lazyPoco))
140140
{
141-
poco.ChainingFeature = (Core.POCO.Core.Features.Feature)lazyPoco.Value;
141+
poco.ChainingFeature = (Core.POCO.Core.Features.IFeature)lazyPoco.Value;
142142
}
143143
else
144144
{

0 commit comments

Comments
 (0)