This documentation is archived and is not being maintained.

SharedPropertyGroupManager Class

Controls access to shared property groups. This class cannot be inherited.

Namespace: System.EnterpriseServices
Assembly: System.EnterpriseServices (in system.enterpriseservices.dll)

'Declaration
<ComVisibleAttribute(False)> _
Public NotInheritable Class SharedPropertyGroupManager
	Implements IEnumerable
'Usage
Dim instance As SharedPropertyGroupManager

/** @attribute ComVisibleAttribute(false) */ 
public final class SharedPropertyGroupManager implements IEnumerable
ComVisibleAttribute(false) 
public final class SharedPropertyGroupManager implements IEnumerable

The following sample shows how to use SharedPropertyGroupManager to create and mange shared properties.

Imports System
Imports System.EnterpriseServices
Imports System.Reflection

<Assembly: ApplicationName("ReceiptNumberGenerator")> 
<Assembly: ApplicationActivation(ActivationOption.Library)> 
 

Public Class ReceiptNumberGeneratorClass
    
    ' Generates a new receipt number based on the receipt number
    ' stored by the Shared Property Manager (SPM)
    Public Function GetNextReceiptNumber() As Integer 
        Dim groupExists, propertyExists As Boolean
        Dim nextReceiptNumber As Integer = 0
        Dim lockMode As PropertyLockMode = PropertyLockMode.SetGet
        Dim releaseMode As PropertyReleaseMode = PropertyReleaseMode.Standard
        
        ' Create a shared property group manager.
        Dim groupManager As New SharedPropertyGroupManager()

        ' Create a shared property group.
        Dim group As SharedPropertyGroup = groupManager.CreatePropertyGroup("Receipts", lockMode, releaseMode, groupExists)
        ' Create a shared property.
        Dim ReceiptNumber As SharedProperty
        ReceiptNumber = group.CreateProperty("ReceiptNumber", propertyExists)

        ' Retrieve the value from shared property, and increment the shared 
        ' property value.
        nextReceiptNumber = Fix(ReceiptNumber.Value)
        ReceiptNumber.Value = nextReceiptNumber + 1

        ' Return nextReceiptNumber
        Return nextReceiptNumber
    
    End Function 'GetNextReceiptNumber

End Class 'ReceiptNumberGeneratorClass

import System.*;
import System.EnterpriseServices.*;
import System.Reflection.*;

/** @assembly AssemblyKeyFile("key.snk")
 */
/** @assembly ApplicationName("ReceiptNumberGenerator")
 */
/** @assembly ApplicationActivation(ActivationOption.Library)
 */

public class ReceiptNumberGeneratorClass
{
    // Generates a new receipt number based on the receipt number
    // stored by the Shared Property Manager (SPM)
    public int GetNextReceiptNumber()
    {
        boolean groupExists = false;
        boolean propertyExists = false;
        int nextReceiptNumber = 0;
        PropertyLockMode lockMode = PropertyLockMode.SetGet;
        PropertyReleaseMode releaseMode = PropertyReleaseMode.Standard;

        // Create a shared property group manager.
        SharedPropertyGroupManager groupManager =
            new SharedPropertyGroupManager();

        // Create a shared property group.
        SharedPropertyGroup group = groupManager.CreatePropertyGroup("Receipts",
            lockMode, releaseMode, groupExists);

        // Create a shared property.
        SharedProperty receiptNumber;
        receiptNumber = group.CreateProperty("receiptNumber", propertyExists);

        // Retrieve the value from shared property, and increment the shared 
        // property value.
        nextReceiptNumber = System.Convert.ToInt32(receiptNumber.get_Value());
        receiptNumber.set_Value((Int32)(nextReceiptNumber + 1));

        // Return nextReceiptNumber
        return nextReceiptNumber;
    } //GetNextReceiptNumber 
} //ReceiptNumberGeneratorClass

System.Object
  System.EnterpriseServices.SharedPropertyGroupManager

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Show: