Repository navigation
Description
What type of issue is this?
- Bug report
- Feature request
Prerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of the SysML2.NET
- I have searched open and closed issues to ensure it has not already been reported
Description
Session (SySML2.NET.REST/Session.cs) only exposes a raw IPsmApiClient: every read hits the server, and elements come back as DTOs the caller must assemble itself. SySML2.NET.REST does not reference SysML2.NET.Dal, so the Assembler is unreachable from the session.
Proposal
-
Element model of the current commit. The session works on one project and one commit at a time. It holds a single
IAssemblerand the(projectId, commitId)it was built from, exposed asISession.CurrentCommit.ISession.GetModel(projectId, commitId)returns the existing POCO cache without a request when the pair matchesCurrentCommit(API & Services §7.1.2: "Commits are immutable"). Otherwise it pages throughGetElementsByProjectCommitAsync, synchronizes a freshAssemblerand replaces the current one — re-synchronizing the existing one would keep elements absent from the new commit. A branch-scoped read resolvesBranch.headfirst, then follows the same path. -
Record cache, policy per type from the §7.1.2 Mutability/Destruction table:
Commit,DataVersion: cached permanently.Tag: cached permanently, evicted when deleted through the session.Project,Branch,Query: configurable time-to-live, evicted on any write through the session that affects them (post, put, delete, commit or merge on the branch).
List endpoints still reach the server (page cursors are opaque) but populate the cache. The PSM defines no
ETag/Cache-Control, so freshness is decided client-side. -
Placement.
Session.Clientbecomes a caching decorator aroundPsmApiClient, generated from the OpenAPI alongsideAutoGenPsmApiClient, so callers keep one API and no write can bypass invalidation. The policy table stays hand-written. -
Close()and re-Open()drop theAssembler, resetCurrentCommitand clear the record cache.ConcurrentDictionarythroughout, matchingAssembler.Cache.
Tasks
- Add a
ProjectReferencefromSySML2.NET.RESTtoSysML2.NET.Dal -
ISession.GetModel(projectId, commitId)+ branch overload andISession.CurrentCommit, backed by a singleAssemblerreplaced on commit change - Hand-written per-record-type cache policy and store
- Generator template emitting the caching
IPsmApiClientdecorator - Time-to-live option for mutable records
- Tests: repeated
GetModelon the current commit issues no HTTP call; switching to a commit where an element was removed leaves no trace of it in the POCO cache; a write evicts the affectedBranch/Project; time-to-live expires mutable records;Close()clears everything
Steps to Reproduce
Not applicable — feature request.
System Configuration
- SysML2.NET version: 0.26.0 (
SysML2.NET.REST) - Environment (Operating system, version and so on): any
- .NET Framework version: netstandard2.1, net10.0
- Additional information: Systems Modeling API & Services 1.0 REST/HTTP PSM
Activity
Fix #446 : session assembler