本文整理汇总了VB.NET中System.EnterpriseServices.SharedProperty类的典型用法代码示例。如果您正苦于以下问题:VB.NET SharedProperty类的具体用法?VB.NET SharedProperty怎么用?VB.NET SharedProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SharedProperty类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: ReceiptNumberGeneratorClass
' 导入命名空间
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