Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Activities / System / ServiceModel / Activities / FromRequest.cs / 1305376 / FromRequest.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.ServiceModel.Activities { using System.Activities; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Runtime; using System.ServiceModel.Channels; using System.ServiceModel.Dispatcher; using SR2 = System.ServiceModel.Activities.SR; class FromRequest : NativeActivity { Collectionparameters; public InOutArgument Message { get; set; } public IDispatchMessageFormatter Formatter { get; set; } public Collection Parameters { get { if (this.parameters == null) { this.parameters = new Collection (); } return this.parameters; } } public InArgument NoPersistHandle { get; set; } internal bool CloseMessage { get; set; } protected override void CacheMetadata(NativeActivityMetadata metadata) { RuntimeArgument messageArgument = new RuntimeArgument(Constants.Message, Constants.MessageType, ArgumentDirection.InOut, true); metadata.Bind(this.Message, messageArgument); metadata.AddArgument(messageArgument); if (this.parameters != null) { int count = 0; foreach (OutArgument parameter in this.parameters) { RuntimeArgument parameterArgument = new RuntimeArgument(Constants.Parameter + count++, parameter.ArgumentType, ArgumentDirection.Out); metadata.Bind(parameter, parameterArgument); metadata.AddArgument(parameterArgument); } } RuntimeArgument noPersistHandleArgument = new RuntimeArgument(Constants.NoPersistHandle, Constants.NoPersistHandleType, ArgumentDirection.In); metadata.Bind(this.NoPersistHandle, noPersistHandleArgument); metadata.AddArgument(noPersistHandleArgument); } protected override void Execute(NativeActivityContext context) { Message inMessage = null; try { inMessage = this.Message.Get(context); object[] outObjects; if (this.parameters == null || this.parameters.Count == 0) { outObjects = Constants.EmptyArray; } else { outObjects = new object[this.parameters.Count]; } this.Formatter.DeserializeRequest(inMessage, outObjects); if (this.parameters != null) { for (int i = 0; i < this.parameters.Count; i++) { OutArgument outArgument = this.parameters[i]; Fx.Assert(outArgument != null, "Parameter cannot be null"); object obj = outObjects[i]; if (obj == null) { obj = ProxyOperationRuntime.GetDefaultParameterValue(outArgument.ArgumentType); } outArgument.Set(context, obj); } } } finally { if (this.CloseMessage && inMessage != null) { inMessage.Close(); } this.Message.Set(context, null); NoPersistHandle handle = (this.NoPersistHandle == null) ? null : this.NoPersistHandle.Get(context); if (handle != null) { handle.Exit(context); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DebugView.cs
- DesignerDataTableBase.cs
- EdmRelationshipRoleAttribute.cs
- XmlILAnnotation.cs
- AtomicFile.cs
- StackBuilderSink.cs
- SerializationException.cs
- cookie.cs
- KeyEvent.cs
- ElementNotAvailableException.cs
- TypeBuilder.cs
- TextFormatterImp.cs
- PtsContext.cs
- IPAddress.cs
- SelectionItemProviderWrapper.cs
- ChangeTracker.cs
- RowCache.cs
- ThreadStartException.cs
- FlowDocumentPageViewerAutomationPeer.cs
- arabicshape.cs
- StorageFunctionMapping.cs
- ConfigXmlDocument.cs
- OleDbConnection.cs
- SynchronousChannelMergeEnumerator.cs
- AxisAngleRotation3D.cs
- DataGridViewColumnEventArgs.cs
- GeneralTransform.cs
- ExternalCalls.cs
- Duration.cs
- ProtocolsConfigurationHandler.cs
- Point4DValueSerializer.cs
- PartialCachingControl.cs
- NonParentingControl.cs
- Animatable.cs
- ApplicationHost.cs
- SafeLocalAllocation.cs
- FontStretches.cs
- BezierSegment.cs
- DesignerEventService.cs
- ConstructorNeedsTagAttribute.cs
- MasterPage.cs
- DynamicArgumentDesigner.xaml.cs
- ViewKeyConstraint.cs
- DataControlImageButton.cs
- HelpKeywordAttribute.cs
- ThemeableAttribute.cs
- SplashScreenNativeMethods.cs
- SoapIgnoreAttribute.cs
- EventRouteFactory.cs
- MailMessage.cs
- VectorCollectionValueSerializer.cs
- WorkflowOperationContext.cs
- ToolStripAdornerWindowService.cs
- CanonicalizationDriver.cs
- X509Certificate.cs
- SqlConnectionManager.cs
- RepeaterItem.cs
- HttpStreams.cs
- RadioButton.cs
- StatusBar.cs
- GenericTextProperties.cs
- Byte.cs
- Path.cs
- SystemWebCachingSectionGroup.cs
- RemotingException.cs
- _FtpControlStream.cs
- BitmapMetadataBlob.cs
- MsmqReceiveHelper.cs
- Translator.cs
- SettingsContext.cs
- CollectionEditVerbManager.cs
- TagPrefixInfo.cs
- AdapterDictionary.cs
- ReturnEventArgs.cs
- Utilities.cs
- cookie.cs
- SqlError.cs
- MenuItemStyle.cs
- HighlightVisual.cs
- DriveNotFoundException.cs
- TextPattern.cs
- SizeChangedEventArgs.cs
- RemotingServices.cs
- DirectionalLight.cs
- UrlMappingCollection.cs
- IResourceProvider.cs
- LocatorPartList.cs
- DesignTimeTemplateParser.cs
- FileChangeNotifier.cs
- FactoryGenerator.cs
- LogRecordSequence.cs
- Privilege.cs
- Binding.cs
- Animatable.cs
- XmlLangPropertyAttribute.cs
- Internal.cs
- TableDetailsRow.cs
- NumericUpDown.cs
- RemoteHelper.cs
- MarkupCompilePass1.cs