ISCApplicationEnvironment
The following table contains information on the ISCApplicationEnvironment interface:
Signature |
Description |
Valid Arguments |
---|---|---|
ISCPropertyBag PropertyBag(VARIANT Category[optional], VARIANT Name[optional], VARIANT AsString[optional]) |
Populates a property bag with one or more property values as indicated by Category and Name |
Category:
Name:
AsString:
|
Feature categories in the Category parameter of the PropertyBag property are hierarchical and use a dot (.) to define feature subsets. For example, the Application category populates a property bag with a complete set of erwin DM features, while Application.API provides a subset related to the API.
If the Category parameter is not set, then the PropertyBag property returns the complete set of all the features from all the available categories.
Example 2
The following example illustrates how to use the API to retrieve the Application Features using C++. It uses the Application object created in Example 1.
void IteratePersistenceUnits(ISCApplicationPtr & scAppPtr) { ISCPropertyBagPtr scBag; // Retrieve all of application environment properties in one call scBag = scAppPtr ->GetApplicationEnvironment()->GetPropertyBag(); // Get an array with categories by using empty string as a category name scBag = scAppPtr ->GetApplicationEnvironment()->GetPropertyBag("", "Categories") // Get Api Version value Application Api category scBag = scAppPtr ->GetApplicationEnvironment()->GetPropertyBag ("Application.Api","Api Version") }
The following example illustrates how to use the API to retrieve the Application Features using Visual Basic .NET. It uses the Application object created in Example 1.
Public Sub GetApplicationFeatures(ByRef scApp As SCAPI.Application) Dim scBag As SCAPI.PropertyBag ' Retrieve all of application environment properties in one call scBag = scApp.ApplicationEnvironment.PropertyBag ' Retrieve values PrintPropertyBag(scBag) ' Get an array with categories by using empty string as a category name scBag = scApp.ApplicationEnvironment.PropertyBag("", "Categories") ' Retrieve a list of categories from the bag Dim aCategories() As String Dim CategoryName As Object If IsArray(scBag.Value("Categories")) Then ' Retrieve an array aCategories = scBag.Value("Categories") If aCategories.Length > 0 Then ' Retrieve values on category basis For Each CategoryName In aCategories ' Get a property bag with values for the category scBag = scApp.ApplicationEnvironment.PropertyBag(CategoryName) Console.WriteLine(" Values for the " + CategoryName + " category:") ' Retrieve values PrintPropertyBag(scBag) Next CategoryName End If End If ' Get Api Version value Application Api category scBag = scApp.ApplicationEnvironment.PropertyBag("Application.Api", "Api Version") ' Retrieve values PrintPropertyBag(oBag) End Sub ' Retrieves and prints values from a property bag Public Sub PrintPropertyBag(ByRef oBag As SCAPI.PropertyBag) Dim Idx As Short Dim nIdx1 As Short If Not (oBag Is Nothing) Then For Idx = 0 To oBag.Count - 1 If IsArray(oBag.Value(Idx)) Then ' Retrieve an array If oBag.Value(Idx).Length > 0 Then Console.WriteLine(Str(Idx) + ") " + oBag.Name(Idx) + " is an array: ") For nIdx1 = 0 To UBound(oBag.Value(Idx)) Console.WriteLine(" " + oBag.Value(Idx)(nIdx1).ToString) Next nIdx1 End If Else ' A single value Console.WriteLine(Str(Idx) + ") " + oBag.Name(Idx) + " = " + oBag.Value(Idx).ToString) End If Next Idx End If End Sub
Copyright © 2023 Quest Software, Inc. |