-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathsnippets.vb
More file actions
98 lines (90 loc) · 3.67 KB
/
Copy pathsnippets.vb
File metadata and controls
98 lines (90 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Imports System.Collections.Generic
Imports System.ServiceModel
Imports System.Workflow.Runtime
Imports System.Workflow.Runtime.Hosting
Imports System.ServiceModel.Description
Imports System.Collections.Specialized
Imports System.ServiceModel.Channels
Namespace ChannelManagerServiceSnippets
Friend Class snippets
Inherits ServiceHostBase
Private Sub Container0()
' ChannelManagerService.ChannelManagerService.
Dim workflowRuntime As New WorkflowRuntime()
'<snippet0>
' Add ChannelManager.
Dim channelmgr As New ChannelManagerService()
workflowRuntime.AddService(channelmgr)
'</snippet0>
End Sub
Private Sub Container1()
Dim contextFileName As String
Dim workflowRuntime As New WorkflowRuntime()
Dim localServiceHost As LocalServiceHost = Nothing
Dim contextFileExtension As String = Nothing
' ChannelManagerService.ChannelManagerService(IList).
'<snippet1>
contextFileName = localServiceHost.Description.ServiceType.Name & contextFileExtension
' add local client endpoints.
workflowRuntime = Me.Description.Behaviors.Find(Of WorkflowRuntimeBehavior)().WorkflowRuntime
workflowRuntime.AddService(New ChannelManagerService(localServiceHost.ClientEndpoints))
localServiceHost.Open()
'</snippet1>
End Sub
Private Sub Container2()
' ChannelManagerService.ChannelManagerService(NameValueCollection).
'<snippet2>
Dim parameters As New NameValueCollection()
With parameters
.Add("idleTimeout", TimeSpan.FromMinutes(10).ToString())
.Add("leaseTimeout", TimeSpan.FromMinutes(1).ToString())
.Add("maxIdleChannelsPerEndpoint", "10")
End With
Dim service As New ChannelManagerService(parameters)
'</snippet2>
End Sub
Private Sub Container3()
' ChannelManagerService.ChannelManagerService(ChannelPoolSettings).
'<snippet3>
Dim settings As New ChannelPoolSettings()
With settings
.IdleTimeout = TimeSpan.FromMinutes(10)
.LeaseTimeout = TimeSpan.FromMinutes(1)
.MaxOutboundChannelsPerEndpoint = 10
End With
Dim service As New ChannelManagerService(settings)
'</snippet3>
End Sub
Private Sub Container4()
' ChannelManagerService.ChannelManagerService(ChannelPoolSettings, Ilist).
Dim contractDescription As ContractDescription = Nothing
'<snippet4>
Dim settings As New ChannelPoolSettings()
With settings
settings.IdleTimeout = TimeSpan.FromMinutes(10)
settings.LeaseTimeout = TimeSpan.FromMinutes(1)
settings.MaxOutboundChannelsPerEndpoint = 10
End With
Dim endpoints As IList(Of ServiceEndpoint) = New List(Of ServiceEndpoint)()
endpoints.Add(New ServiceEndpoint(contractDescription))
Dim service As New ChannelManagerService(settings, endpoints)
'</snippet4>
End Sub
Private Class LocalServiceHost
Inherits ServiceHost
Public Sub New(ByVal singletonInstance As Object, ParamArray ByVal baseAddresses() As Uri)
MyBase.New(singletonInstance, baseAddresses)
End Sub
Private clientEndpoints_Renamed As IList(Of ServiceEndpoint) = Nothing
Friend ReadOnly Property ClientEndpoints() As IList(Of ServiceEndpoint)
Get
Return clientEndpoints_Renamed
End Get
End Property
End Class
Protected Overrides Function _
CreateDescription(<System.Runtime.InteropServices.Out()> ByRef implementedContracts As IDictionary(Of String, ContractDescription)) As ServiceDescription
Throw New NotImplementedException()
End Function
End Class
End Namespace