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
- EntityAdapter.cs
- TraceHwndHost.cs
- SessionStateSection.cs
- TextInfo.cs
- ThaiBuddhistCalendar.cs
- CancelEventArgs.cs
- SiteMapNodeCollection.cs
- ContentElementCollection.cs
- ListItemParagraph.cs
- BaseHashHelper.cs
- AlphaSortedEnumConverter.cs
- VirtualDirectoryMapping.cs
- EditorPartCollection.cs
- StorageMappingItemLoader.cs
- SafeArrayRankMismatchException.cs
- GuidelineSet.cs
- MailMessage.cs
- TypeContext.cs
- TransactionValidationBehavior.cs
- httpapplicationstate.cs
- DataViewListener.cs
- DataTableMapping.cs
- ProxyManager.cs
- SimpleType.cs
- File.cs
- EditableTreeList.cs
- FormDocumentDesigner.cs
- FieldNameLookup.cs
- XhtmlStyleClass.cs
- CodePrimitiveExpression.cs
- StringUtil.cs
- XmlILStorageConverter.cs
- AppearanceEditorPart.cs
- DbFunctionCommandTree.cs
- SQLBinaryStorage.cs
- FocusChangedEventArgs.cs
- ListViewItem.cs
- RemotingConfigParser.cs
- HtmlGenericControl.cs
- SmiTypedGetterSetter.cs
- ListQueryResults.cs
- TemplateBindingExpressionConverter.cs
- ColorMatrix.cs
- Relationship.cs
- SecurityPolicySection.cs
- ViewStateException.cs
- StringAnimationUsingKeyFrames.cs
- MarkupWriter.cs
- TypeForwardedFromAttribute.cs
- MembershipPasswordException.cs
- TrackingRecord.cs
- TreeNodeBindingCollection.cs
- GZipUtils.cs
- ServiceInstanceProvider.cs
- ElementNotEnabledException.cs
- InputMethodStateChangeEventArgs.cs
- FontStretchConverter.cs
- TraceFilter.cs
- ChangeBlockUndoRecord.cs
- MenuItemCollection.cs
- InputScopeNameConverter.cs
- RectConverter.cs
- DefaultSection.cs
- DataGridDesigner.cs
- CaseInsensitiveOrdinalStringComparer.cs
- Utils.cs
- XhtmlBasicPageAdapter.cs
- URI.cs
- RoutedEventConverter.cs
- EventDescriptorCollection.cs
- WasHttpModulesInstallComponent.cs
- SafeThemeHandle.cs
- ObjRef.cs
- XmlIlVisitor.cs
- VideoDrawing.cs
- ServiceDescriptionContext.cs
- ExpandSegment.cs
- FixUpCollection.cs
- LayoutInformation.cs
- Margins.cs
- ExtenderProvidedPropertyAttribute.cs
- XamlPointCollectionSerializer.cs
- SynchronizedRandom.cs
- ObjectComplexPropertyMapping.cs
- ServicePointManager.cs
- DependencyPropertyConverter.cs
- IisTraceWebEventProvider.cs
- HttpRuntimeSection.cs
- ViewPort3D.cs
- DesignRelationCollection.cs
- DataContractJsonSerializerOperationFormatter.cs
- MediaScriptCommandRoutedEventArgs.cs
- EndpointIdentityExtension.cs
- ProcessThreadDesigner.cs
- GeneralTransform.cs
- FrameworkElementAutomationPeer.cs
- ButtonRenderer.cs
- NumberSubstitution.cs
- IImplicitResourceProvider.cs
- TextDecoration.cs