SharedPropertyGroupManager クラス
定義
共有プロパティ グループへのアクセスを制御します。Controls access to shared property groups. このクラスは継承できません。This class cannot be inherited.
public ref class SharedPropertyGroupManager sealed : System::Collections::IEnumerable
[System.Runtime.InteropServices.ComVisible(false)]
public sealed class SharedPropertyGroupManager : System.Collections.IEnumerable
[<System.Runtime.InteropServices.ComVisible(false)>]
type SharedPropertyGroupManager = class
interface IEnumerable
Public NotInheritable Class SharedPropertyGroupManager
Implements IEnumerable
- 継承
-
SharedPropertyGroupManager
- 属性
- 実装
例
次の例では、を使用し SharedPropertyGroupManager
て共有プロパティを作成および操作する方法を示します。The following sample shows how to use SharedPropertyGroupManager
to create and mange shared properties.
#using <System.EnterpriseServices.dll>
using namespace System;
using namespace System::EnterpriseServices;
using namespace System::Reflection;
[assembly:AssemblyKeyFile("..\\common\\key.snk")];
[assembly:ApplicationName("ReceiptNumberGenerator")];
[assembly:ApplicationActivation(ActivationOption::Library)];
public ref class ReceiptNumberGeneratorClass
{
public:
// Generates a new receipt number based on the receipt number
// stored by the Shared Property Manager (SPM)
int GetNextReceiptNumber()
{
bool groupExists;
bool propertyExists;
int nextReceiptNumber = 0;
PropertyLockMode lockMode = PropertyLockMode::SetGet;
PropertyReleaseMode releaseMode = PropertyReleaseMode::Standard;
// Create a shared property group manager.
SharedPropertyGroupManager^ groupManager = gcnew 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 = safe_cast<int>(ReceiptNumber->Value);
ReceiptNumber->Value = nextReceiptNumber + 1;
// Return nextReceiptNumber
return nextReceiptNumber;
}
};
using System;
using System.EnterpriseServices;
using 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 int GetNextReceiptNumber()
{
bool groupExists,propertyExists;
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",
ref lockMode, ref releaseMode, out groupExists);
// Create a shared property.
SharedProperty ReceiptNumber;
ReceiptNumber = group.CreateProperty("ReceiptNumber",out propertyExists);
// Retrieve the value from shared property, and increment the shared
// property value.
nextReceiptNumber = (int) ReceiptNumber.Value;
ReceiptNumber.Value = nextReceiptNumber + 1;
// Return nextReceiptNumber
return nextReceiptNumber;
}
}
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
コンストラクター
SharedPropertyGroupManager() |
SharedPropertyGroupManager クラスの新しいインスタンスを初期化します。Initializes a new instance of the SharedPropertyGroupManager class. |
メソッド
CreatePropertyGroup(String, PropertyLockMode, PropertyReleaseMode, Boolean) |
指定された情報でプロパティ グループを検索または作成します。Finds or creates a property group with the given information. |
Equals(Object) |
指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object. (継承元 Object) |
GetEnumerator() |
コレクションの列挙体インターフェイスを取得します。Retrieves the enumeration interface for the collection. |
GetHashCode() |
既定のハッシュ関数として機能します。Serves as the default hash function. (継承元 Object) |
GetType() |
現在のインスタンスの Type を取得します。Gets the Type of the current instance. (継承元 Object) |
Group(String) |
指定された名前のプロパティ グループを検索します。Finds the property group with the given name. |
MemberwiseClone() |
現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object. (継承元 Object) |
ToString() |
現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object. (継承元 Object) |
拡張メソッド
Cast<TResult>(IEnumerable) |
IEnumerable の要素を、指定した型にキャストします。Casts the elements of an IEnumerable to the specified type. |
OfType<TResult>(IEnumerable) |
指定された型に基づいて IEnumerable の要素をフィルター処理します。Filters the elements of an IEnumerable based on a specified type. |
AsParallel(IEnumerable) |
クエリの並列化を有効にします。Enables parallelization of a query. |
AsQueryable(IEnumerable) |
IEnumerable を IQueryable に変換します。Converts an IEnumerable to an IQueryable. |