本文整理汇总了C#中System.EnterpriseServices.SharedPropertyGroupManager类的典型用法代码示例。如果您正苦于以下问题:C# SharedPropertyGroupManager类的具体用法?C# SharedPropertyGroupManager怎么用?C# SharedPropertyGroupManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SharedPropertyGroupManager类属于System.EnterpriseServices命名空间,在下文中一共展示了SharedPropertyGroupManager类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ApplicationName
//引入命名空间
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;
}
}
开发者ID:.NET开发者,项目名称:System.EnterpriseServices,代码行数:35,代码来源:SharedPropertyGroupManager
注:本文中的System.EnterpriseServices.SharedPropertyGroupManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论