internal ImmutableDispatchRuntime(DispatchRuntime dispatch) { _concurrency = new ConcurrencyBehavior(dispatch); _error = new ErrorBehavior(dispatch.ChannelDispatcher); EnableFaults = dispatch.EnableFaults; _instance = new InstanceBehavior(dispatch, this); ManualAddressing = dispatch.ManualAddressing; _messageInspectors = EmptyArray <IDispatchMessageInspector> .ToArray(dispatch.MessageInspectors); _terminate = TerminatingOperationBehavior.CreateIfNecessary(dispatch); _thread = new ThreadBehavior(dispatch); _sendAsynchronously = dispatch.ChannelDispatcher.SendAsynchronously; CorrelationCount = dispatch.MaxParameterInspectors; DispatchOperationRuntime unhandled = new DispatchOperationRuntime(dispatch.UnhandledDispatchOperation, this); ActionDemuxer demuxer = new ActionDemuxer(); for (int i = 0; i < dispatch.Operations.Count; i++) { DispatchOperation operation = dispatch.Operations[i]; DispatchOperationRuntime operationRuntime = new DispatchOperationRuntime(operation, this); demuxer.Add(operation.Action, operationRuntime); } demuxer.SetUnhandled(unhandled); _demuxer = demuxer; _processMessage1 = ProcessMessage1; _processMessage11 = ProcessMessage11; _processMessage2 = ProcessMessage2; _processMessage3 = ProcessMessage3; _processMessage31 = ProcessMessage31; _processMessage4 = ProcessMessage4; _processMessage41 = ProcessMessage41; _processMessage5 = ProcessMessage5; _processMessage6 = ProcessMessage6; _processMessage7 = ProcessMessage7; _processMessage8 = ProcessMessage8; _processMessage9 = ProcessMessage9; _processMessageCleanup = ProcessMessageCleanup; _processMessageCleanupError = ProcessMessageCleanupError; }
internal ImmutableDispatchRuntime(DispatchRuntime dispatch) { this.authenticationBehavior = AuthenticationBehavior.TryCreate(dispatch); this.authorizationBehavior = AuthorizationBehavior.TryCreate(dispatch); this.concurrency = new ConcurrencyBehavior(dispatch); this.error = new ErrorBehavior(dispatch.ChannelDispatcher); this.enableFaults = dispatch.EnableFaults; this.inputSessionShutdownHandlers = EmptyArray<IInputSessionShutdown>.ToArray(dispatch.InputSessionShutdownHandlers); this.instance = new InstanceBehavior(dispatch, this); this.isOnServer = dispatch.IsOnServer; this.manualAddressing = dispatch.ManualAddressing; this.messageInspectors = EmptyArray<IDispatchMessageInspector>.ToArray(dispatch.MessageInspectors); this.requestReplyCorrelator = new RequestReplyCorrelator(); this.securityImpersonation = SecurityImpersonationBehavior.CreateIfNecessary(dispatch); this.requireClaimsPrincipalOnOperationContext = dispatch.RequireClaimsPrincipalOnOperationContext; this.impersonateOnSerializingReply = dispatch.ImpersonateOnSerializingReply; this.terminate = TerminatingOperationBehavior.CreateIfNecessary(dispatch); this.thread = new ThreadBehavior(dispatch); this.validateMustUnderstand = dispatch.ValidateMustUnderstand; this.ignoreTransactionFlow = dispatch.IgnoreTransactionMessageProperty; this.transaction = TransactionBehavior.CreateIfNeeded(dispatch); this.receiveContextEnabledChannel = dispatch.ChannelDispatcher.ReceiveContextEnabled; this.sendAsynchronously = dispatch.ChannelDispatcher.SendAsynchronously; this.parameterInspectorCorrelationOffset = (dispatch.MessageInspectors.Count + dispatch.MaxCallContextInitializers); this.correlationCount = this.parameterInspectorCorrelationOffset + dispatch.MaxParameterInspectors; DispatchOperationRuntime unhandled = new DispatchOperationRuntime(dispatch.UnhandledDispatchOperation, this); if (dispatch.OperationSelector == null) { ActionDemuxer demuxer = new ActionDemuxer(); for (int i = 0; i < dispatch.Operations.Count; i++) { DispatchOperation operation = dispatch.Operations[i]; DispatchOperationRuntime operationRuntime = new DispatchOperationRuntime(operation, this); demuxer.Add(operation.Action, operationRuntime); } demuxer.SetUnhandled(unhandled); this.demuxer = demuxer; } else { CustomDemuxer demuxer = new CustomDemuxer(dispatch.OperationSelector); for (int i = 0; i < dispatch.Operations.Count; i++) { DispatchOperation operation = dispatch.Operations[i]; DispatchOperationRuntime operationRuntime = new DispatchOperationRuntime(operation, this); demuxer.Add(operation.Name, operationRuntime); } demuxer.SetUnhandled(unhandled); this.demuxer = demuxer; } this.processMessage1 = new MessageRpcProcessor(this.ProcessMessage1); this.processMessage11 = new MessageRpcProcessor(this.ProcessMessage11); this.processMessage2 = new MessageRpcProcessor(this.ProcessMessage2); this.processMessage3 = new MessageRpcProcessor(this.ProcessMessage3); this.processMessage31 = new MessageRpcProcessor(this.ProcessMessage31); this.processMessage4 = new MessageRpcProcessor(this.ProcessMessage4); this.processMessage41 = new MessageRpcProcessor(this.ProcessMessage41); this.processMessage5 = new MessageRpcProcessor(this.ProcessMessage5); this.processMessage6 = new MessageRpcProcessor(this.ProcessMessage6); this.processMessage7 = new MessageRpcProcessor(this.ProcessMessage7); this.processMessage8 = new MessageRpcProcessor(this.ProcessMessage8); this.processMessage9 = new MessageRpcProcessor(this.ProcessMessage9); this.processMessageCleanup = new MessageRpcProcessor(this.ProcessMessageCleanup); this.processMessageCleanupError = new MessageRpcProcessor(this.ProcessMessageCleanupError); }