Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / Management / BufferedWebEventProvider.cs / 1 / 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(); } } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StrongNamePublicKeyBlob.cs
- IdentityHolder.cs
- FixedSOMGroup.cs
- Hash.cs
- Clipboard.cs
- WebContentFormatHelper.cs
- DataBoundControlAdapter.cs
- CounterCreationDataCollection.cs
- FlowDocumentReaderAutomationPeer.cs
- ResourceExpressionBuilder.cs
- PairComparer.cs
- HttpRequestCacheValidator.cs
- RegisterResponseInfo.cs
- BlobPersonalizationState.cs
- CombinedHttpChannel.cs
- ClientConvert.cs
- CompiledRegexRunner.cs
- FacetDescription.cs
- MetadataFile.cs
- WebPartUtil.cs
- CornerRadiusConverter.cs
- EntityCommandDefinition.cs
- DrawingAttributeSerializer.cs
- CanonicalFontFamilyReference.cs
- ProcessInputEventArgs.cs
- JoinGraph.cs
- DataRecordInfo.cs
- ValueSerializerAttribute.cs
- DateTimeConverter2.cs
- WeakReferenceKey.cs
- SQLMembershipProvider.cs
- IApplicationTrustManager.cs
- ClientOptions.cs
- Char.cs
- GradientStopCollection.cs
- ProfileSettingsCollection.cs
- Exceptions.cs
- StringCollection.cs
- CodeDirectoryCompiler.cs
- DefaultValueConverter.cs
- SkewTransform.cs
- _ChunkParse.cs
- DbMetaDataColumnNames.cs
- FlowLayoutPanel.cs
- CfgParser.cs
- Animatable.cs
- RemoteWebConfigurationHostStream.cs
- TextEffectResolver.cs
- SHA1.cs
- DetailsView.cs
- BmpBitmapDecoder.cs
- EntityConnection.cs
- ErrorStyle.cs
- MediaSystem.cs
- AppModelKnownContentFactory.cs
- AnimatedTypeHelpers.cs
- InvokePattern.cs
- BufferAllocator.cs
- StyleXamlTreeBuilder.cs
- SimpleBitVector32.cs
- CompiledIdentityConstraint.cs
- ItemDragEvent.cs
- Rotation3DAnimationBase.cs
- StrokeDescriptor.cs
- InputProcessorProfiles.cs
- KnownIds.cs
- HttpException.cs
- FrameworkObject.cs
- EntryIndex.cs
- CollectionExtensions.cs
- ConnectionInterfaceCollection.cs
- CodeExporter.cs
- TimeZoneInfo.cs
- ArrayList.cs
- WeakReadOnlyCollection.cs
- OleDbFactory.cs
- Selector.cs
- OpenFileDialog.cs
- AliasGenerator.cs
- WebPartHelpVerb.cs
- XmlnsDefinitionAttribute.cs
- SectionXmlInfo.cs
- XmlSchemaDatatype.cs
- SimpleWorkerRequest.cs
- BrowserDefinition.cs
- RuleSettingsCollection.cs
- XsltInput.cs
- DataGridColumn.cs
- BulletChrome.cs
- SessionStateSection.cs
- SoapEnumAttribute.cs
- PageTrueTypeFont.cs
- HttpCapabilitiesBase.cs
- PreservationFileWriter.cs
- WebReferencesBuildProvider.cs
- Marshal.cs
- LayoutSettings.cs
- Collection.cs
- compensatingcollection.cs
- ZipIORawDataFileBlock.cs