diff --git a/SySML2.NET.REST/ISession.cs b/SySML2.NET.REST/ISession.cs
index b5148c1c1..68551d26a 100644
--- a/SySML2.NET.REST/ISession.cs
+++ b/SySML2.NET.REST/ISession.cs
@@ -9,91 +9,10 @@
namespace SySML2.NET.REST
{
- using System;
- using System.Threading;
- using System.Threading.Tasks;
-
- using SysML2.NET.Dal;
- using SysML2.NET.PSM;
- using SysML2.NET.PSM.DTO;
-
///
/// Definition of the that holds the connection to a server of the Systems Modeling API and Services
///
- public interface ISession
+ public interface ISession : ISessionContext, ISessionLifecycle
{
- ///
- /// Gets the that holds the element model of the current commit
- ///
- IAssembler Assembler { get; }
-
- ///
- /// Gets the of the open connection, or null when the session is closed
- ///
- IPsmApiClient Client { get; }
-
- ///
- /// Gets the project and commit whose element model the session holds, or null when it holds none
- ///
- (Guid ProjectId, Guid CommitId)? CurrentCommit { get; }
-
- ///
- /// Closes the connection to the server and drops the element model it read
- ///
- void Close();
-
- ///
- /// Loads the element model of the head of a branch into the , leaving it empty when the branch has no commit
- ///
- ///
- /// The identifier of the project
- ///
- ///
- /// The identifier of the branch
- ///
- ///
- /// The that cancels the operation
- ///
- ///
- /// An awaitable
- ///
- ///
- /// Thrown when the session is closed, or when the server links a page of elements that it already returned
- ///
- Task LoadBranchHead(Guid projectId, Guid branchId, CancellationToken cancellationToken);
-
- ///
- /// Loads the element model of a commit into the , read once per commit since a commit is immutable (Systems Modeling API and Services §7.1.2)
- ///
- ///
- /// The identifier of the project
- ///
- ///
- /// The identifier of the commit
- ///
- ///
- /// The that cancels the operation
- ///
- ///
- /// An awaitable
- ///
- ///
- /// Thrown when the session is closed, or when the server links a page of elements that it already returned
- ///
- Task LoadCommit(Guid projectId, Guid commitId, CancellationToken cancellationToken);
-
- ///
- /// Opens a connection to the server, replacing any open connection, and reads the first page of its projects
- ///
- ///
- /// The absolute base address of the server
- ///
- ///
- /// The that cancels the operation
- ///
- ///
- /// The first page of the projects of the server
- ///
- Task> Open(Uri baseAddress, CancellationToken cancellationToken);
}
}
diff --git a/SySML2.NET.REST/ISessionContext.cs b/SySML2.NET.REST/ISessionContext.cs
new file mode 100644
index 000000000..7f12778e7
--- /dev/null
+++ b/SySML2.NET.REST/ISessionContext.cs
@@ -0,0 +1,78 @@
+// ------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+// SPDX-License-Identifier: Apache-2.0
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SySML2.NET.REST
+{
+ using System;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ using SysML2.NET.Dal;
+
+ ///
+ /// Definition of the that reads from the connection of a session and loads its element model, without opening or closing it
+ ///
+ public interface ISessionContext
+ {
+ ///
+ /// Gets the that holds the element model of the current commit
+ ///
+ IAssembler Assembler { get; }
+
+ ///
+ /// Gets the of the open connection, or null when the session is closed
+ ///
+ IPsmApiClient Client { get; }
+
+ ///
+ /// Gets the project and commit whose element model the session holds, or null when it holds none
+ ///
+ (Guid ProjectId, Guid CommitId)? CurrentCommit { get; }
+
+ ///
+ /// Loads the element model of the head of a branch into the , leaving it empty when the branch has no commit
+ ///
+ ///
+ /// The identifier of the project
+ ///
+ ///
+ /// The identifier of the branch
+ ///
+ ///
+ /// The that cancels the operation
+ ///
+ ///
+ /// An awaitable
+ ///
+ ///
+ /// Thrown when the session is closed, or when the server links a page of elements that it already returned
+ ///
+ Task LoadBranchHead(Guid projectId, Guid branchId, CancellationToken cancellationToken);
+
+ ///
+ /// Loads the element model of a commit into the , read once per commit since a commit is immutable (Systems Modeling API and Services §7.1.2)
+ ///
+ ///
+ /// The identifier of the project
+ ///
+ ///
+ /// The identifier of the commit
+ ///
+ ///
+ /// The that cancels the operation
+ ///
+ ///
+ /// An awaitable
+ ///
+ ///
+ /// Thrown when the session is closed, or when the server links a page of elements that it already returned
+ ///
+ Task LoadCommit(Guid projectId, Guid commitId, CancellationToken cancellationToken);
+ }
+}
diff --git a/SySML2.NET.REST/ISessionLifecycle.cs b/SySML2.NET.REST/ISessionLifecycle.cs
new file mode 100644
index 000000000..d0cf01f58
--- /dev/null
+++ b/SySML2.NET.REST/ISessionLifecycle.cs
@@ -0,0 +1,49 @@
+// ------------------------------------------------------------------------------------------------
+//
+//
+// Copyright (C) 2022-2026 Starion Group S.A.
+// SPDX-License-Identifier: Apache-2.0
+//
+//
+// ------------------------------------------------------------------------------------------------
+
+namespace SySML2.NET.REST
+{
+ using System;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ using SysML2.NET.PSM;
+ using SysML2.NET.PSM.DTO;
+
+ ///
+ /// Definition of the that opens and closes the connection of a session to a server of the Systems Modeling API and Services
+ ///
+ public interface ISessionLifecycle
+ {
+ ///
+ /// Closes the connection to the server and drops the element model it read
+ ///
+ void Close();
+
+ ///
+ /// Opens a connection to the server, replacing any open connection, and reads the first page of its projects
+ ///
+ ///
+ /// The absolute base address of the server
+ ///
+ ///
+ /// The that cancels the operation
+ ///
+ ///
+ /// The first page of the projects of the server
+ ///
+ ///
+ /// Thrown when is null
+ ///
+ ///
+ /// Thrown when is not absolute
+ ///
+ Task> Open(Uri baseAddress, CancellationToken cancellationToken);
+ }
+}