This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
SysML2.NET is a .NET C# SDK implementing the OMG SysML v2 specification (based on Beta 4 pilot implementation). It provides metaclass DTOs/POCOs, serializers (JSON, XMI, MessagePack), a REST client, a DAL layer, and a Blazor WebAssembly viewer application. Current version: 0.19.0.
# Restore and build entire solution
dotnet restore SysML2.NET.sln
dotnet build SysML2.NET.sln
# Run all tests
dotnet test SysML2.NET.sln
# Run tests for a specific project
dotnet test SysML2.NET.Tests/SysML2.NET.Tests.csproj
dotnet test SysML2.NET.Serializer.Json.Tests/SysML2.NET.Serializer.Json.Tests.csproj
# Run a single test by name
dotnet test SysML2.NET.Tests/SysML2.NET.Tests.csproj --filter "FullyQualifiedName~AcceptActionUsageExtensionsTestFixture"
# Run with coverage (as CI does)
dotnet-coverage collect "dotnet test SysML2.NET.sln --no-build" -f xml -o coverage.xmlTest framework: NUnit. Test classes use [TestFixture] and [Test] attributes.
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.
The pipeline:
- Input:
Resources/KerML_only_xmi.umlandResources/SysML_only_xmi.uml(UML XMI metamodel files) - Generator:
SysML2.NET.CodeGeneratorreads these viauml4net.xmi, uses Handlebars templates (Templates/Uml/*.hbs) to generate code - Output:
AutoGen*directories across multiple projects
Generator classes in SysML2.NET.CodeGenerator/Generators/UmlHandleBarsGenerators/ produce:
- DTOs and interfaces →
SysML2.NET/Core/AutoGenDto/ - POCOs →
SysML2.NET/Core/AutoGenPoco/ - Enums →
SysML2.NET/Core/AutoGenEnum/ - JSON serializers/deserializers →
SysML2.NET.Serializer.Json/Core/AutoGenSerializer/andAutoGenDeSerializer/ - MessagePack formatters →
SysML2.NET.Serializer.MessagePack/ - Extension methods (Extend) →
SysML2.NET/Extend/ - DAL factories →
SysML2.NET.Dal/Core/
SysML2.NET (core: netstandard2.1)
├── Core/AutoGenDto/ - 342 files: DTO classes + interfaces (171 metaclasses × 2)
├── Core/AutoGenPoco/ - POCO classes + interfaces
├── Core/AutoGenEnum/ - Enums (FeatureDirectionKind, VisibilityKind, etc.)
├── Core/DTO/ - Hand-coded base: IElement : IData
├── Core/POCO/ - Hand-coded: IContainedElement, IContainedRelationship
├── Extend/ - Auto-generated extension methods per metaclass
├── Decorators/ - [Class], [Property], [Implements] attributes from UML
├── PIM/ - Platform-Independent Model DTOs (REST API types)
├── ModelInterchange/ - Archive/project interchange types (kpar support)
└── Common/IData.cs - Base interface with Id property
SysML2.NET.Extensions - Comparers, utilities across metaclasses
SysML2.NET.Serializer.Json - JSON (de)serialization via System.Text.Json
SysML2.NET.Serializer.Xmi - XMI (de)serialization
SysML2.NET.Serializer.MessagePack - MessagePack binary serialization
SysML2.NET.Serializer.Dictionary - Dictionary-based serialization (PIM)
SysML2.NET.Dal - Data Access Layer (Assembler, ElementFactory)
SysML2.NET.REST - REST client + Session for SysML2 API servers
SysML2.NET.Kpar - Reader/Writer for .kpar archive format
SysML2.NET.Viewer - Blazor WebAssembly app (net9.0)
SysML2.NET.CodeGenerator - Code generation tool (net10.0, not packaged)
Each metaclass exists in two forms:
- DTO (Data Transfer Object): Lightweight, uses
Guidreferences for relationships. Used for serialization/transport. Properties reference other elements byGuidID. - POCO (Plain Old CLR Object): Rich object model with resolved object references. Used for in-memory manipulation. Uses
ContainerList<T>for containment relationships.
Both share the same I{MetaclassName} interface from AutoGenDto/. The hand-coded Core/DTO/IElement.cs adds IData (which provides Guid Id) to the root interface.
Auto-generated DTOs use structured namespaces reflecting the KerML/SysML package hierarchy:
SysML2.NET.Core.DTO.Root.Elements(Element, Annotation, etc.)SysML2.NET.Core.DTO.Core.Types(Type, Feature, Classifier, etc.)SysML2.NET.Core.DTO.Systems.Actions(ActionUsage, etc.)
- Core library (
SysML2.NET):netstandard2.1 - Test projects and CodeGenerator:
net10.0 - Viewer:
net9.0(Blazor WebAssembly)
- Commit messages use prefix tags:
[Add],[Update],[Remove],[Fix] - Main branch:
master. Development branch:development - CI: GitHub Actions (
CodeQuality.yml) — builds, tests, and runs SonarQube analysis - License: Apache 2.0 (code), LGPL v3.0 (metamodel files)
- To add a new metaclass: update the UML XMI source files, then run the code generators — do not manually create AutoGen files