ISCPersistenceUnit Interface

The following table contains information on the ISCPersistenceUnit interface:

Signature

Description

Valid Arguments

VARIANT_BOOL Save(VARIANT Locator [optional], VARIANT Disposition [optional]

Persists model data to external storage

Locator:

  • VT_BSTR � Full path of the location to store the model. Provides a new location for the persistence unit data source as a string with a file or mart item location, along with the attributes required for successful access to storage.
  • Empty � Indicates the use of the original persistence unit location.

Disposition:

Specifies changes in access attributes, such as read only.

Example 26

The following example illustrates how to save a model using C++. The example uses a Persistence Unit object from Example 5:

void Save( ISCPersistenceUnitPtr & scPUnitPtr )
{  
    ISCPropertyBagPtr propBag = scPUnitPtr->GetPropertyBag ("Locator");
    long index = 0;
    _bstr_t bstrFileName = propBag->GetValue(COleVariant(index));
    // Change bstrFileName to a new location
    scPUnitPtr->Save(bstrFileName);
}

The following example illustrates how to save a model using Visual Basic .NET. The example uses a Persistence Unit object from Example 5:

Public Sum Save( scPUnit As SCAPI.PersistenceUnit )
    Dim propBag as SCAPI.PropertyBag
    propBag = scUnit.PropertyBag(�Locator�)
    Dim sFileName As String
    sFileName = propBag.Value(�Locator�)
    sFileName = sFileName + �.bak�
    scPUnit.Save(sFileName )
End Sub