Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,4 @@ MigrationBackup/
# WinMerge bak files
*.bak
/switcher.json
/.claude/settings.local.json
5 changes: 5 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ Test framework: **NUnit**. Test classes use `[TestFixture]` and `[Test]` attribu

## Architecture

### Code Generation

- favour duplicated code in codegeneration to have staticaly defined methods that provide performance over reflection based code.
- code generation is done by processing the UML model and creating handlebars templates

### Code Generation Pipeline

Most code in this repo is **auto-generated** — files marked `THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!` must not be edited directly.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public class AnnotatingElementReader : XmiDataReader<IAnnotatingElement>
/// </param>
/// <param name="externalReferenceService">The injected <see cref="IExternalReferenceService"/> used to register and process external references</param>
/// <param name="loggerFactory">The injected <see cref="ILoggerFactory" /> used to set up logging</param>
public AnnotatingElementReader(IXmiDataCache cache, IXmiDataReaderFacade xmiDataReaderFacade, IExternalReferenceService externalReferenceService, ILoggerFactory loggerFactory) : base(cache, xmiDataReaderFacade, externalReferenceService, loggerFactory)
/// <param name="elementOriginMap">The optional <see cref="IXmiElementOriginMap"/> used to track element-to-file associations</param>
public AnnotatingElementReader(IXmiDataCache cache, IXmiDataReaderFacade xmiDataReaderFacade, IExternalReferenceService externalReferenceService, ILoggerFactory loggerFactory, IXmiElementOriginMap elementOriginMap = null) : base(cache, xmiDataReaderFacade, externalReferenceService, loggerFactory, elementOriginMap)
{
this.logger = loggerFactory == null ? NullLogger<AnnotatingElementReader>.Instance : loggerFactory.CreateLogger<AnnotatingElementReader>();
}
Expand Down Expand Up @@ -107,6 +108,8 @@ public override IAnnotatingElement Read(XmlReader xmiReader, Uri currentLocation
this.logger.LogCritical("Failed to add element type [{Poco}] with id [{Id}] as it was already in the Cache. The XMI document seems to have duplicate xmi:id values", "AnnotatingElement", poco.Id);
}

this.ElementOriginMap?.Register(poco.Id, currentLocation);

var aliasIdsXmlAttribute = xmiReader.GetAttribute("aliasIds");

if (!string.IsNullOrWhiteSpace(aliasIdsXmlAttribute))
Expand Down Expand Up @@ -257,7 +260,7 @@ public override IAnnotatingElement Read(XmlReader xmiReader, Uri currentLocation
}
else
{
var ownedRelationshipValue = (IRelationship)this.XmiDataReaderFacade.QueryXmiData(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory);
var ownedRelationshipValue = (IRelationship)this.XmiDataReaderFacade.QueryXmiData(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory, elementOriginMap: this.ElementOriginMap);

((IContainedElement)poco).OwnedRelationship.Add(ownedRelationshipValue);
}
Expand All @@ -278,7 +281,7 @@ public override IAnnotatingElement Read(XmlReader xmiReader, Uri currentLocation
}
else
{
var owningRelationshipValue = (IRelationship)this.XmiDataReaderFacade.QueryXmiData(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory);
var owningRelationshipValue = (IRelationship)this.XmiDataReaderFacade.QueryXmiData(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory, elementOriginMap: this.ElementOriginMap);

((IContainedElement)poco).OwningRelationship = owningRelationshipValue;
}
Expand Down Expand Up @@ -335,6 +338,8 @@ public override async Task<IAnnotatingElement> ReadAsync(XmlReader xmiReader, Ur
this.logger.LogCritical("Failed to add element type [{Poco}] with id [{Id}] as it was already in the Cache. The XMI document seems to have duplicate xmi:id values", "AnnotatingElement", poco.Id);
}

this.ElementOriginMap?.Register(poco.Id, currentLocation);

var aliasIdsXmlAttribute = xmiReader.GetAttribute("aliasIds");

if (!string.IsNullOrWhiteSpace(aliasIdsXmlAttribute))
Expand Down Expand Up @@ -485,7 +490,7 @@ public override async Task<IAnnotatingElement> ReadAsync(XmlReader xmiReader, Ur
}
else
{
var ownedRelationshipValue = (IRelationship)await this.XmiDataReaderFacade.QueryXmiDataAsync(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory);
var ownedRelationshipValue = (IRelationship)await this.XmiDataReaderFacade.QueryXmiDataAsync(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory, elementOriginMap: this.ElementOriginMap);

((IContainedElement)poco).OwnedRelationship.Add(ownedRelationshipValue);
}
Expand All @@ -506,7 +511,7 @@ public override async Task<IAnnotatingElement> ReadAsync(XmlReader xmiReader, Ur
}
else
{
var owningRelationshipValue = (IRelationship)await this.XmiDataReaderFacade.QueryXmiDataAsync(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory);
var owningRelationshipValue = (IRelationship)await this.XmiDataReaderFacade.QueryXmiDataAsync(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory, elementOriginMap: this.ElementOriginMap);

((IContainedElement)poco).OwningRelationship = owningRelationshipValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public class AssociationReader : XmiDataReader<IAssociation>
/// </param>
/// <param name="externalReferenceService">The injected <see cref="IExternalReferenceService"/> used to register and process external references</param>
/// <param name="loggerFactory">The injected <see cref="ILoggerFactory" /> used to set up logging</param>
public AssociationReader(IXmiDataCache cache, IXmiDataReaderFacade xmiDataReaderFacade, IExternalReferenceService externalReferenceService, ILoggerFactory loggerFactory) : base(cache, xmiDataReaderFacade, externalReferenceService, loggerFactory)
/// <param name="elementOriginMap">The optional <see cref="IXmiElementOriginMap"/> used to track element-to-file associations</param>
public AssociationReader(IXmiDataCache cache, IXmiDataReaderFacade xmiDataReaderFacade, IExternalReferenceService externalReferenceService, ILoggerFactory loggerFactory, IXmiElementOriginMap elementOriginMap = null) : base(cache, xmiDataReaderFacade, externalReferenceService, loggerFactory, elementOriginMap)
{
this.logger = loggerFactory == null ? NullLogger<AssociationReader>.Instance : loggerFactory.CreateLogger<AssociationReader>();
}
Expand Down Expand Up @@ -111,6 +112,8 @@ public override IAssociation Read(XmlReader xmiReader, Uri currentLocation)
this.logger.LogCritical("Failed to add element type [{Poco}] with id [{Id}] as it was already in the Cache. The XMI document seems to have duplicate xmi:id values", "Association", poco.Id);
}

this.ElementOriginMap?.Register(poco.Id, currentLocation);

var aliasIdsXmlAttribute = xmiReader.GetAttribute("aliasIds");

if (!string.IsNullOrWhiteSpace(aliasIdsXmlAttribute))
Expand Down Expand Up @@ -357,7 +360,7 @@ public override IAssociation Read(XmlReader xmiReader, Uri currentLocation)
}
else
{
var ownedRelatedElementValue = (IElement)this.XmiDataReaderFacade.QueryXmiData(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory);
var ownedRelatedElementValue = (IElement)this.XmiDataReaderFacade.QueryXmiData(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory, elementOriginMap: this.ElementOriginMap);

((IContainedRelationship)poco).OwnedRelatedElement.Add(ownedRelatedElementValue);
}
Expand All @@ -378,7 +381,7 @@ public override IAssociation Read(XmlReader xmiReader, Uri currentLocation)
}
else
{
var ownedRelationshipValue = (IRelationship)this.XmiDataReaderFacade.QueryXmiData(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory);
var ownedRelationshipValue = (IRelationship)this.XmiDataReaderFacade.QueryXmiData(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory, elementOriginMap: this.ElementOriginMap);

((IContainedElement)poco).OwnedRelationship.Add(ownedRelationshipValue);
}
Expand All @@ -399,7 +402,7 @@ public override IAssociation Read(XmlReader xmiReader, Uri currentLocation)
}
else
{
var owningRelatedElementValue = (IElement)this.XmiDataReaderFacade.QueryXmiData(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory);
var owningRelatedElementValue = (IElement)this.XmiDataReaderFacade.QueryXmiData(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory, elementOriginMap: this.ElementOriginMap);

((IContainedRelationship)poco).OwningRelatedElement = owningRelatedElementValue;
}
Expand All @@ -420,7 +423,7 @@ public override IAssociation Read(XmlReader xmiReader, Uri currentLocation)
}
else
{
var owningRelationshipValue = (IRelationship)this.XmiDataReaderFacade.QueryXmiData(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory);
var owningRelationshipValue = (IRelationship)this.XmiDataReaderFacade.QueryXmiData(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory, elementOriginMap: this.ElementOriginMap);

((IContainedElement)poco).OwningRelationship = owningRelationshipValue;
}
Expand Down Expand Up @@ -477,6 +480,8 @@ public override async Task<IAssociation> ReadAsync(XmlReader xmiReader, Uri curr
this.logger.LogCritical("Failed to add element type [{Poco}] with id [{Id}] as it was already in the Cache. The XMI document seems to have duplicate xmi:id values", "Association", poco.Id);
}

this.ElementOriginMap?.Register(poco.Id, currentLocation);

var aliasIdsXmlAttribute = xmiReader.GetAttribute("aliasIds");

if (!string.IsNullOrWhiteSpace(aliasIdsXmlAttribute))
Expand Down Expand Up @@ -723,7 +728,7 @@ public override async Task<IAssociation> ReadAsync(XmlReader xmiReader, Uri curr
}
else
{
var ownedRelatedElementValue = (IElement)await this.XmiDataReaderFacade.QueryXmiDataAsync(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory);
var ownedRelatedElementValue = (IElement)await this.XmiDataReaderFacade.QueryXmiDataAsync(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory, elementOriginMap: this.ElementOriginMap);

((IContainedRelationship)poco).OwnedRelatedElement.Add(ownedRelatedElementValue);
}
Expand All @@ -744,7 +749,7 @@ public override async Task<IAssociation> ReadAsync(XmlReader xmiReader, Uri curr
}
else
{
var ownedRelationshipValue = (IRelationship)await this.XmiDataReaderFacade.QueryXmiDataAsync(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory);
var ownedRelationshipValue = (IRelationship)await this.XmiDataReaderFacade.QueryXmiDataAsync(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory, elementOriginMap: this.ElementOriginMap);

((IContainedElement)poco).OwnedRelationship.Add(ownedRelationshipValue);
}
Expand All @@ -765,7 +770,7 @@ public override async Task<IAssociation> ReadAsync(XmlReader xmiReader, Uri curr
}
else
{
var owningRelatedElementValue = (IElement)await this.XmiDataReaderFacade.QueryXmiDataAsync(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory);
var owningRelatedElementValue = (IElement)await this.XmiDataReaderFacade.QueryXmiDataAsync(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory, elementOriginMap: this.ElementOriginMap);

((IContainedRelationship)poco).OwningRelatedElement = owningRelatedElementValue;
}
Expand All @@ -786,7 +791,7 @@ public override async Task<IAssociation> ReadAsync(XmlReader xmiReader, Uri curr
}
else
{
var owningRelationshipValue = (IRelationship)await this.XmiDataReaderFacade.QueryXmiDataAsync(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory);
var owningRelationshipValue = (IRelationship)await this.XmiDataReaderFacade.QueryXmiDataAsync(xmiReader, this.Cache, currentLocation, this.ExternalReferenceService, this.LoggerFactory, elementOriginMap: this.ElementOriginMap);

((IContainedElement)poco).OwningRelationship = owningRelationshipValue;
}
Expand Down
Loading
Loading