-
Notifications
You must be signed in to change notification settings - Fork 3
Session
The Session class is the core class of the CDP4-SDK for API developers that wish to develop C# applications that need to interface with ECSS-E-TM-10-25A Annex C. It provides a layer of abstraction for the IDal
interface that exposes the methods that can be used to Create, Read, Update and Delete objects from an Annex C data-source.
The
ISession
interface works with POCO instances, theIDal
interface works with DTO instances.
The Credentials class is used to capture information required to connect to a data-source. It carries the username, password and URI of the data-source. The Credentials
are used to instantiate a Sesssion
object and cannot be changed while the Session
is active.
The Session
class implements the ISession interface that exposes the following core methods:
method | description | async |
---|---|---|
Open | Open a connection to a data-source | y |
Read | Read Things from a data-source |
y |
Write | Write updates to Things to a data-source |
y |
Refresh | Update the Cache with updated Things from a data-source |
y |
Reload | Reload all Things from a data-source for all open TopContainers
|
y |
Close | Close the connection to a data-source and clear the Cache | n |
The ISession
interface exposes more convenience methods that are explained in the following sections.
The Session
class constructor expects 2 arguments, an instance of IDal
and an instance of Credential
. The IDal
interface represents a Data Access Layer implementation used to perform operations on a ECSS-E-TM-10-25 Annex C data-source.
var uri = new Uri("https://cdp4services-public.rheagroup.com");
var credentrials = new Credentials("some-user-name", "some-password", uri);
var dal = new CdpServicesDal();
var session = new Session(dal, credentials);
The Open
method connects to the data-source and requests data from the SiteDirectory
route provided by the Annex C data-source. The data-source returns an array of DTO instances that are processed by the Assembler, converted into POCO instances that are add to the Cache. Messages are produced for the objects that are added to the Cache by means of the CDP Message Bus.
try
{
await session.Open();
}
catch(Exception ex)
{
// handle the exception here and don't forget to do some logging
}
The Open
method should be used in combination with await
operator, await
can only be used in an asynchronous method modified by the async
keyword.
The data that is returned contains enough information for the current user to select an
Iteration
or aReference Data Library
to work with.
Three distinct Read
methods are provided by the ISession
interface:
-
public async Task Read(Iteration iteration, DomainOfExpertise domain)
: reads data from the data-source related to a specificIteration
, including all the objects that are contained by the specifiedIteration
. -
public async Task Read(ReferenceDataLibrary rdl)
: reads data from the data-source related to a specificReferenceDataLibrary
, including all the objects that are contained by the specifiedIteration
. -
public async Task Read(Thing thing)
: reads anyThing
from the data-source.
Most concepts contained by an Iteration
are owned by a DomainOfExpertise
.
more information coming soon
more information coming soon
more information coming soon
more information coming soon
copyright @ Starion Group S.A.