ISCSession Interface
The following table contains information on the ISCSession interface:
Signature |
Description |
Valid Arguments |
---|---|---|
VARIANT_BOOL Open(IUnknown * ModelSet, VARIANT Level [optional], VARIANT Flags [optional]) |
Binds self to the model set identified by the ModelSet parameter |
ModelSet:
Level:
Flags:
|
Example 7
The following example illustrates how to open a session with the EM2 model of a persistence unit using C++. The example uses the Application object created in Example 1 and the CreateNewModel function from Example 4:
void OpenEM2(ISCApplicationPtr & scAppPtr) { ISCSessionCollectionPtr scSessionColPtr = scAppPtr->GetSessions(); ISCPersistenceUnitPtr scPUnitPtr = CreateNewModel(scAppPtr); // From Example 4 ISCModelSetPtr scEMXModelSetPtr = scPUnitPtr->ModelSet(); // Collect the top model set ISCModelSetPtr scEM2ModelSetPtr = scEMXModelSetPtr- >GetOwnedModelSets()->GetItem(COleVariant("EM2")); if (scEM2ModelPtr != NULL) { ISCSessionPtr scSessionPtr = scSessionColPtr->Add(); // add a new session CComVariant varResult = scSessionPtr->Open(scEM2ModelSetPtr); if (varResult.vt == VT_BOOL && varResult.boolVal == FALSE) return; // … }
The following example illustrates how to open a session with the EM2 model of a persistence unit using Visual Basic .NET. The example uses the Application object created in Example 1 and the CreateNewModel function from Example 4:
Public Sub OpenEM2(ByRef scApp As SCAPI.Application )
Dim scSession As SCAPI.Session Dim scEMXModelSet As SCAPI.ModelSet Dim scEM2ModelSet As SCAPI.ModelSet Dim scPUnit As SCAPI.PersistenceUnit scSessionCol = scApp.Sessions scPUnit = CreateNewModel(scApp) ' From Example 4 ' Access the top model set - of EMX type scEMXModelSet = persUnit.ModelSet ' Access an owned EM2 model set by class name scEM2ModelSet = scEMXModelSet.OwnedModelSets("EM2") Console.WriteLine(vbTab + " Access EM2 Model Set by class name" + scEM2ModelSet.Name + _" Id " + scEM2ModelSet.ModelSetId) Console.WriteLine(vbTab + vbTab + " Class Name " + scEM2ModelSet.ClassName + _" Class id " + scEM2ModelSet.ClassId) scSession = scSessionCol.Add ' new session scSession.Open(scEM2ModelSet, SCD_SL_M0) ' connect EM2 to a session '… End Sub
Copyright © 2025 Quest Software, Inc. |