BaseChannelObjectWithProperties Class

Definition

Provides a base implementation of a channel object that exposes a dictionary interface to its properties.

C#
public abstract class BaseChannelObjectWithProperties : System.Collections.IDictionary
C#
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class BaseChannelObjectWithProperties : System.Collections.IDictionary
C#
[System.Runtime.InteropServices.ComVisible(true)]
[System.Security.SecurityCritical]
public abstract class BaseChannelObjectWithProperties : System.Collections.IDictionary
Inheritance
BaseChannelObjectWithProperties
Derived
Attributes
Implements

Examples

C#
   public class LoggingServerChannelSinkProvider : IServerChannelSinkProvider
   {
      private IServerChannelSinkProvider next2 = null;
      public LoggingServerChannelSinkProvider(IDictionary properties, ICollection providerData)
      {
      }
      public void GetChannelData(IChannelDataStore channelData)
      {
      }
      public IServerChannelSink CreateSink(IChannelReceiver channel1)
      {
         IServerChannelSink localNextSink = null;
         if (next2 != null)
            localNextSink = next2.CreateSink(channel1);
         return new LoggingServerChannelSink(localNextSink);
      }
      public IServerChannelSinkProvider Next
      {
         get
         {
            return next2;
         }
         set
         {
            next2 = value;
         }
      }
   }
   
   internal class LoggingServerChannelSink : BaseChannelObjectWithProperties, IServerChannelSink
   {
      private IServerChannelSink nextSink2 = null;
      private bool bEnabled2 = true;
      public LoggingServerChannelSink(IServerChannelSink localNextSink) : base()
      {
         nextSink2 = localNextSink;
      }
      public ServerProcessing ProcessMessage(   IServerChannelSinkStack sinkStack,
   IMessage requestMsg,
   ITransportHeaders requestHeaders,
   Stream requestStream,
   out IMessage responseMsg,
   out ITransportHeaders responseHeaders,
   out Stream responseStream
)
      {
         if (bEnabled2)
         {
            Console.WriteLine("----------Request Headers-----------");
            Console.WriteLine( CommonTransportKeys.IPAddress + ":" +
               requestHeaders[CommonTransportKeys.IPAddress]);
            Console.WriteLine( CommonTransportKeys.ConnectionId + ":" +
               requestHeaders[CommonTransportKeys.ConnectionId]);
            Console.WriteLine( CommonTransportKeys.RequestUri + ":" +
               requestHeaders[CommonTransportKeys.RequestUri]);
         }
         sinkStack.Push(this, null);
         ServerProcessing processing =
            nextSink2.ProcessMessage(sinkStack, requestMsg, requestHeaders, requestStream, out responseMsg,
            out responseHeaders, out responseStream);

         switch (processing)
         {
            case ServerProcessing.Complete :
            {
               sinkStack.Pop(this);
               break;
            }
            case ServerProcessing.OneWay:
            {
               sinkStack.Pop(this);
               break;
            }
            case ServerProcessing.Async:
            {
               sinkStack.Store(this, null);
               break;
            }
         }
         return processing;
      }
      public void AsyncProcessResponse(IServerResponseChannelSinkStack sinkStack, Object state,
         IMessage msg, ITransportHeaders headers, Stream stream1)
      {
         sinkStack.AsyncProcessResponse(msg, headers, stream1);
      }
      public Stream GetResponseStream(IServerResponseChannelSinkStack sinkStack, Object state,
         IMessage msg, ITransportHeaders headers)
      {
         return null;
      }
      public IServerChannelSink NextChannelSink
      {
         get
         {
            return nextSink2;
         }
      }
   }

Remarks

BaseChannelObjectWithProperties is the base class for BaseChannelWithProperties and BaseChannelSinkWithProperties.

BaseChannelWithProperties and BaseChannelSinkWithProperties can be used as the base classes for channels and channel sinks that provide named properties.

BaseChannelObjectWithProperties handles the complex task of asking a channel object for its properties.

This class makes a link demand and an inheritance demand at the class level. A SecurityException is thrown when either the immediate caller or the derived class does not have infrastructure permission. For details about security demands, see Link Demands and Inheritance Demands.

Notes to Implementers

When you inherit from BaseChannelObjectWithProperties, you must override the Keys property and the Item[Object] property.

Constructors

BaseChannelObjectWithProperties()

Initializes a new instance of the BaseChannelObjectWithProperties class.

Properties

Count

Gets the number of properties associated with the channel object.

IsFixedSize

Gets a value that indicates whether the number of properties that can be entered into the channel object is fixed.

IsReadOnly

Gets a value that indicates whether the collection of properties in the channel object is read-only.

IsSynchronized

Gets a value that indicates whether the dictionary of channel object properties is synchronized.

Item[Object]

When overridden in a derived class, gets or sets the property that is associated with the specified key.

Keys

When overridden in a derived class, gets a ICollection of keys that the channel object properties are associated with.

Properties

Gets a IDictionary of the channel properties associated with the channel object.

SyncRoot

Gets an object that is used to synchronize access to the BaseChannelObjectWithProperties.

Values

Gets a ICollection of the values of the properties associated with the channel object.

Methods

Add(Object, Object)

Throws a NotSupportedException.

Clear()

Throws a NotSupportedException.

Contains(Object)

Returns a value that indicates whether the channel object contains a property that is associated with the specified key.

CopyTo(Array, Int32)

Throws a NotSupportedException.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator()

Returns a IDictionaryEnumerator that enumerates over all the properties associated with the channel object.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(Object)

Throws a NotSupportedException.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Returns a IEnumerator that enumerates over all the properties that are associated with the channel object.

Extension Methods

Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1