Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Server / System / Data / Services / DataServiceOperationContext.cs / 1458001 / DataServiceOperationContext.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Class holding all the context about the current request being // processed. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services { #region Namespaces using System; using System.Diagnostics; using System.Net; #endregion Namespaces ////// Class holding all the context about the current operation being processed. /// public sealed class DataServiceOperationContext { #region Private Fields ////// Host interface for the current operation. /// private readonly IDataServiceHost hostInterface; ////// Host wrapper for the current operation. The wrapper class caches the request header values and validates the data from the host interface. /// private DataServiceHostWrapper hostWrapper; ////// True if the current operation is part of a batch request. /// private bool? isBatchRequest; #endregion Private Fields #region Constructor ////// Constructs a new instance of DataServiceOperationContext object /// /// Host instance for the current operation context. internal DataServiceOperationContext(IDataServiceHost host) { Debug.Assert(host != null, "host != null"); this.hostInterface = host; } ////// Constructs a new instance of DataServiceOperationContext object /// /// True if the current operation is part of a batch request. /// Host instance for the current operation context. internal DataServiceOperationContext(bool isBatchRequest, IDataServiceHost2 host) : this(host) { this.isBatchRequest = isBatchRequest; } #endregion Constructor #region Public Properties ////// True if the current operation is part of a batch request. /// public bool IsBatchRequest { get { if (!this.isBatchRequest.HasValue) { string[] segments = RequestUriProcessor.EnumerateSegments(this.AbsoluteRequestUri, this.AbsoluteServiceUri); if (segments.Length > 0 && segments[0] == XmlConstants.UriBatchSegment) { this.isBatchRequest = true; } else { this.isBatchRequest = false; } } return this.isBatchRequest.Value; } } ////// The HTTP request method (GET, POST, etc.) /// public string RequestMethod { get { return this.hostWrapper.RequestHttpMethod; } } ////// Request Uri for the current operation. /// public Uri AbsoluteRequestUri { get { return this.hostWrapper.AbsoluteRequestUri; } } ////// Base service Uri for the request. /// public Uri AbsoluteServiceUri { get { return this.hostWrapper.AbsoluteServiceUri; } } ////// Request headers for the current operation. /// public WebHeaderCollection RequestHeaders { get { return this.hostWrapper.RequestHeaders; } } ////// Response headers for the current operation. /// public WebHeaderCollection ResponseHeaders { get { return this.hostWrapper.ResponseHeaders; } } ////// Gets and sets the response status code /// public int ResponseStatusCode { get { return this.hostWrapper.ResponseStatusCode; } set { this.hostWrapper.ResponseStatusCode = value; } } #endregion Public Properties #region Internal Properties ////// Host instance for the current operation. /// internal DataServiceHostWrapper Host { get { Debug.Assert(this.hostWrapper != null, "Must call InitializeAndCacheHeaders() before calling the Host property."); return this.hostWrapper; } } #endregion Internal Properties #region Internal Methods ////// Creates a new instance of the host wrapper to cache the request headers and to validate the data from the host interface. /// internal void InitializeAndCacheHeaders() { Debug.Assert(this.hostInterface != null, "this.hostInterface != null"); this.hostWrapper = new DataServiceHostWrapper(this.hostInterface); } #endregion Internal Methods } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Class holding all the context about the current request being // processed. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services { #region Namespaces using System; using System.Diagnostics; using System.Net; #endregion Namespaces ////// Class holding all the context about the current operation being processed. /// public sealed class DataServiceOperationContext { #region Private Fields ////// Host interface for the current operation. /// private readonly IDataServiceHost hostInterface; ////// Host wrapper for the current operation. The wrapper class caches the request header values and validates the data from the host interface. /// private DataServiceHostWrapper hostWrapper; ////// True if the current operation is part of a batch request. /// private bool? isBatchRequest; #endregion Private Fields #region Constructor ////// Constructs a new instance of DataServiceOperationContext object /// /// Host instance for the current operation context. internal DataServiceOperationContext(IDataServiceHost host) { Debug.Assert(host != null, "host != null"); this.hostInterface = host; } ////// Constructs a new instance of DataServiceOperationContext object /// /// True if the current operation is part of a batch request. /// Host instance for the current operation context. internal DataServiceOperationContext(bool isBatchRequest, IDataServiceHost2 host) : this(host) { this.isBatchRequest = isBatchRequest; } #endregion Constructor #region Public Properties ////// True if the current operation is part of a batch request. /// public bool IsBatchRequest { get { if (!this.isBatchRequest.HasValue) { string[] segments = RequestUriProcessor.EnumerateSegments(this.AbsoluteRequestUri, this.AbsoluteServiceUri); if (segments.Length > 0 && segments[0] == XmlConstants.UriBatchSegment) { this.isBatchRequest = true; } else { this.isBatchRequest = false; } } return this.isBatchRequest.Value; } } ////// The HTTP request method (GET, POST, etc.) /// public string RequestMethod { get { return this.hostWrapper.RequestHttpMethod; } } ////// Request Uri for the current operation. /// public Uri AbsoluteRequestUri { get { return this.hostWrapper.AbsoluteRequestUri; } } ////// Base service Uri for the request. /// public Uri AbsoluteServiceUri { get { return this.hostWrapper.AbsoluteServiceUri; } } ////// Request headers for the current operation. /// public WebHeaderCollection RequestHeaders { get { return this.hostWrapper.RequestHeaders; } } ////// Response headers for the current operation. /// public WebHeaderCollection ResponseHeaders { get { return this.hostWrapper.ResponseHeaders; } } ////// Gets and sets the response status code /// public int ResponseStatusCode { get { return this.hostWrapper.ResponseStatusCode; } set { this.hostWrapper.ResponseStatusCode = value; } } #endregion Public Properties #region Internal Properties ////// Host instance for the current operation. /// internal DataServiceHostWrapper Host { get { Debug.Assert(this.hostWrapper != null, "Must call InitializeAndCacheHeaders() before calling the Host property."); return this.hostWrapper; } } #endregion Internal Properties #region Internal Methods ////// Creates a new instance of the host wrapper to cache the request headers and to validate the data from the host interface. /// internal void InitializeAndCacheHeaders() { Debug.Assert(this.hostInterface != null, "this.hostInterface != null"); this.hostWrapper = new DataServiceHostWrapper(this.hostInterface); } #endregion Internal Methods } } // 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
- HtmlControlPersistable.cs
- StateChangeEvent.cs
- CodeIdentifier.cs
- GiveFeedbackEventArgs.cs
- TriggerActionCollection.cs
- PostBackOptions.cs
- CopyOnWriteList.cs
- HttpCookieCollection.cs
- GroupBoxAutomationPeer.cs
- VectorAnimation.cs
- TextDecorationCollection.cs
- HScrollBar.cs
- DataExpression.cs
- FrameworkTextComposition.cs
- XmlEventCache.cs
- RangeValidator.cs
- Function.cs
- EnumerableWrapperWeakToStrong.cs
- LocalizedNameDescriptionPair.cs
- MenuItemStyleCollectionEditor.cs
- SiteMapDataSourceView.cs
- Int16Animation.cs
- Point3DAnimationBase.cs
- FormViewUpdateEventArgs.cs
- Oci.cs
- EventToken.cs
- MultiByteCodec.cs
- ContainerParaClient.cs
- Header.cs
- MultiByteCodec.cs
- RawStylusSystemGestureInputReport.cs
- PropertyGridCommands.cs
- SystemIPGlobalStatistics.cs
- DataMember.cs
- Interlocked.cs
- IsolatedStorageFileStream.cs
- DataControlReference.cs
- EndOfStreamException.cs
- StretchValidation.cs
- PictureBox.cs
- DataExpression.cs
- UInt64Converter.cs
- RegexReplacement.cs
- CheckableControlBaseAdapter.cs
- OleCmdHelper.cs
- ReferentialConstraint.cs
- UserControlCodeDomTreeGenerator.cs
- GetPageNumberCompletedEventArgs.cs
- OpenTypeLayoutCache.cs
- WebPartConnectionCollection.cs
- WebControl.cs
- HealthMonitoringSection.cs
- StorageBasedPackageProperties.cs
- SupportingTokenDuplexChannel.cs
- SemaphoreFullException.cs
- TextAutomationPeer.cs
- FormsAuthenticationUserCollection.cs
- StateMachine.cs
- RC2CryptoServiceProvider.cs
- FamilyMapCollection.cs
- DataGridViewIntLinkedList.cs
- CodeSnippetCompileUnit.cs
- VisualBasicImportReference.cs
- TcpConnectionPoolSettingsElement.cs
- TextEditorSelection.cs
- RSACryptoServiceProvider.cs
- SoapClientMessage.cs
- CodeChecksumPragma.cs
- LineMetrics.cs
- WebBrowserEvent.cs
- TriState.cs
- TextEditorCopyPaste.cs
- TypeSystem.cs
- AnnouncementInnerClientCD1.cs
- ADMembershipUser.cs
- CertificateManager.cs
- DataGridPagingPage.cs
- SqlCommandBuilder.cs
- RepeatInfo.cs
- SingleQueryOperator.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- ColumnResult.cs
- CommunicationObjectFaultedException.cs
- KeyboardEventArgs.cs
- SSmlParser.cs
- MonitorWrapper.cs
- XmlText.cs
- ModuleBuilderData.cs
- XmlUtil.cs
- IdentitySection.cs
- StopStoryboard.cs
- CommandID.cs
- SystemIPAddressInformation.cs
- TargetException.cs
- MetadataArtifactLoaderResource.cs
- WpfSharedXamlSchemaContext.cs
- BoundColumn.cs
- MetadataCollection.cs
- ErrorStyle.cs
- TableLayoutColumnStyleCollection.cs