Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / Management / BufferedWebEventProvider.cs / 2 / BufferedWebEventProvider.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Management { using System; using System.Web; using System.Diagnostics; using System.Web.Util; using System.Web.Configuration; using System.Configuration.Provider; using System.Collections; using System.Collections.Specialized; using System.Configuration; using System.Security; using Debug=System.Web.Util.Debug; using System.Security.Permissions; // Interface for buffered event provider [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public abstract class BufferedWebEventProvider : WebEventProvider { bool _buffer = true; string _bufferMode; WebEventBuffer _webEventBuffer; public override void Initialize(string name, NameValueCollection config) { // create buffer according to the buffer mode settings specified, like we do in sql/mail providers // wire up the delegate to the ProcessEventFlush method Debug.Trace("BufferedWebEventProvider", "Initializing: name=" + name); ProviderUtil.GetAndRemoveBooleanAttribute(config, "buffer", name, ref _buffer); if (_buffer) { ProviderUtil.GetAndRemoveRequiredNonEmptyStringAttribute(config, "bufferMode", name, ref _bufferMode); _webEventBuffer = new WebEventBuffer(this, _bufferMode, new WebEventBufferFlushCallback(this.ProcessEventFlush)); } else { ProviderUtil.GetAndRemoveStringAttribute(config, "bufferMode", name, ref _bufferMode); } base.Initialize(name, config); ProviderUtil.CheckUnrecognizedAttributes(config, name); } public bool UseBuffering { get { return _buffer; } } public string BufferMode { get { return _bufferMode; } } public override void ProcessEvent(WebBaseEvent eventRaised) { if (_buffer) { // register the event with the buffer instead of writing it out Debug.Trace("BufferedWebEventProvider", "Saving event to buffer: event=" + eventRaised.GetType().Name); _webEventBuffer.AddEvent(eventRaised); } else { WebEventBufferFlushInfo flushInfo = new WebEventBufferFlushInfo( new WebBaseEventCollection(eventRaised), EventNotificationType.Unbuffered, 0, DateTime.MinValue, 0, 0); ProcessEventFlush(flushInfo); } } public abstract void ProcessEventFlush(WebEventBufferFlushInfo flushInfo); public override void Flush() { if (_buffer) { _webEventBuffer.Flush(Int32.MaxValue, FlushCallReason.StaticFlush); } } public override void Shutdown() { if (_webEventBuffer != null) { _webEventBuffer.Shutdown(); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Management { using System; using System.Web; using System.Diagnostics; using System.Web.Util; using System.Web.Configuration; using System.Configuration.Provider; using System.Collections; using System.Collections.Specialized; using System.Configuration; using System.Security; using Debug=System.Web.Util.Debug; using System.Security.Permissions; // Interface for buffered event provider [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public abstract class BufferedWebEventProvider : WebEventProvider { bool _buffer = true; string _bufferMode; WebEventBuffer _webEventBuffer; public override void Initialize(string name, NameValueCollection config) { // create buffer according to the buffer mode settings specified, like we do in sql/mail providers // wire up the delegate to the ProcessEventFlush method Debug.Trace("BufferedWebEventProvider", "Initializing: name=" + name); ProviderUtil.GetAndRemoveBooleanAttribute(config, "buffer", name, ref _buffer); if (_buffer) { ProviderUtil.GetAndRemoveRequiredNonEmptyStringAttribute(config, "bufferMode", name, ref _bufferMode); _webEventBuffer = new WebEventBuffer(this, _bufferMode, new WebEventBufferFlushCallback(this.ProcessEventFlush)); } else { ProviderUtil.GetAndRemoveStringAttribute(config, "bufferMode", name, ref _bufferMode); } base.Initialize(name, config); ProviderUtil.CheckUnrecognizedAttributes(config, name); } public bool UseBuffering { get { return _buffer; } } public string BufferMode { get { return _bufferMode; } } public override void ProcessEvent(WebBaseEvent eventRaised) { if (_buffer) { // register the event with the buffer instead of writing it out Debug.Trace("BufferedWebEventProvider", "Saving event to buffer: event=" + eventRaised.GetType().Name); _webEventBuffer.AddEvent(eventRaised); } else { WebEventBufferFlushInfo flushInfo = new WebEventBufferFlushInfo( new WebBaseEventCollection(eventRaised), EventNotificationType.Unbuffered, 0, DateTime.MinValue, 0, 0); ProcessEventFlush(flushInfo); } } public abstract void ProcessEventFlush(WebEventBufferFlushInfo flushInfo); public override void Flush() { if (_buffer) { _webEventBuffer.Flush(Int32.MaxValue, FlushCallReason.StaticFlush); } } public override void Shutdown() { if (_webEventBuffer != null) { _webEventBuffer.Shutdown(); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FormViewInsertedEventArgs.cs
- ThousandthOfEmRealPoints.cs
- Environment.cs
- FileIOPermission.cs
- SevenBitStream.cs
- Point3DCollection.cs
- DataRelation.cs
- BitStream.cs
- SymLanguageType.cs
- SiteMapPath.cs
- ToolboxBitmapAttribute.cs
- PersonalizationProviderCollection.cs
- ConnectionPoint.cs
- TableLayout.cs
- IOThreadScheduler.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- TemplateColumn.cs
- SchemaTableColumn.cs
- PlaceHolder.cs
- Effect.cs
- DoubleAnimationUsingPath.cs
- AlternateViewCollection.cs
- EventData.cs
- DBAsyncResult.cs
- DebuggerAttributes.cs
- ThreadAbortException.cs
- SafeArrayTypeMismatchException.cs
- WebBrowserHelper.cs
- OleDbInfoMessageEvent.cs
- Matrix3DStack.cs
- BufferModesCollection.cs
- DateTimeOffset.cs
- Vector.cs
- SingleAnimationUsingKeyFrames.cs
- BindingsCollection.cs
- StorageInfo.cs
- LineServices.cs
- AliasExpr.cs
- LoginCancelEventArgs.cs
- AccessDataSourceWizardForm.cs
- Timeline.cs
- AssertSection.cs
- TextTreeTextNode.cs
- MSHTMLHost.cs
- DynamicPropertyReader.cs
- ContextQuery.cs
- WebConfigurationFileMap.cs
- ErasingStroke.cs
- XmlToDatasetMap.cs
- ZoneIdentityPermission.cs
- StateDesigner.Layouts.cs
- OperationContractGenerationContext.cs
- CodeIndexerExpression.cs
- XhtmlTextWriter.cs
- glyphs.cs
- Blend.cs
- DateTime.cs
- ConnectivityStatus.cs
- SqlCacheDependencyDatabase.cs
- SmtpNetworkElement.cs
- DocumentPageViewAutomationPeer.cs
- ConditionedDesigner.cs
- _SslState.cs
- SHA1.cs
- SHA384Managed.cs
- ValidatorCompatibilityHelper.cs
- TypedReference.cs
- DataFormats.cs
- UnorderedHashRepartitionStream.cs
- FontConverter.cs
- StylusCollection.cs
- HyperlinkAutomationPeer.cs
- PartialCachingAttribute.cs
- UdpTransportBindingElement.cs
- SyndicationItemFormatter.cs
- PositiveTimeSpanValidatorAttribute.cs
- LogicalExpressionEditor.cs
- ControlBindingsCollection.cs
- InputMethod.cs
- IntegerValidatorAttribute.cs
- OdbcConnection.cs
- SamlAdvice.cs
- CodeCommentStatementCollection.cs
- ActivationArguments.cs
- SoapElementAttribute.cs
- AuthenticationModuleElementCollection.cs
- StoryFragments.cs
- PageBuildProvider.cs
- TailCallAnalyzer.cs
- IisTraceWebEventProvider.cs
- InvariantComparer.cs
- ValueHandle.cs
- ViewBox.cs
- DataGridColumnCollection.cs
- IPPacketInformation.cs
- Metafile.cs
- GeometryConverter.cs
- Trace.cs
- WsdlImporterElement.cs
- InterleavedZipPartStream.cs