BaseChannelObjectWithProperties Class
Collapse the table of content
Expand the table of content

BaseChannelObjectWithProperties Class

 

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

Namespace:   System.Runtime.Remoting.Channels
Assembly:  mscorlib (in mscorlib.dll)


[SecurityCriticalAttribute]
[ComVisibleAttribute(true)]
[SecurityPermissionAttribute(SecurityAction.InheritanceDemand, 
	Flags = SecurityPermissionFlag.Infrastructure)]
public abstract class BaseChannelObjectWithProperties : IDictionary, 
	ICollection, IEnumerable

NameDescription
System_CAPS_protmethodBaseChannelObjectWithProperties()

Initializes a new instance of the BaseChannelObjectWithProperties class.

NameDescription
System_CAPS_pubpropertyCount

Gets the number of properties associated with the channel object.

System_CAPS_pubpropertyIsFixedSize

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

System_CAPS_pubpropertyIsReadOnly

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

System_CAPS_pubpropertyIsSynchronized

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

System_CAPS_pubpropertyItem[Object]

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

System_CAPS_pubpropertyKeys

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

System_CAPS_pubpropertyProperties

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

System_CAPS_pubpropertySyncRoot

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

System_CAPS_pubpropertyValues

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

NameDescription
System_CAPS_pubmethodAdd(Object, Object)
System_CAPS_pubmethodClear()
System_CAPS_pubmethodContains(Object)

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

System_CAPS_pubmethodCopyTo(Array, Int32)
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetEnumerator()

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

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodRemove(Object)
System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIEnumerable.GetEnumerator()

This API supports the product infrastructure and is not intended to be used directly from your code. Returns a IEnumerator that enumerates over all the properties that are associated with the channel object.

NameDescription
System_CAPS_pubmethodAsParallel()

Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.)

System_CAPS_pubmethodAsQueryable()

Overloaded. Converts an IEnumerable to an IQueryable.(Defined by Queryable.)

System_CAPS_pubmethodCast<TResult>()

Casts the elements of an IEnumerable to the specified type.(Defined by Enumerable.)

System_CAPS_pubmethodOfType<TResult>()

Filters the elements of an IEnumerable based on a specified type.(Defined by Enumerable.)

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 Inheritors:

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

   [PermissionSet(SecurityAction.Demand, Name="FullTrust")]
   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;
         }
      }
   }
   [PermissionSet(SecurityAction.Demand, Name="FullTrust")]
   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;
         }
      }
   }

SecurityPermission

For operating with infrastructure code. Demand value: SecurityAction.LinkDemand; Permission value: SecurityPermissionFlag.Infrastructure

SecurityPermission

For operating with infrastructure code. Demand value: SecurityAction.InheritanceDemand; Permission value: SecurityPermissionFlag.Infrastructure

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft