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 MustInherit Class BaseChannelObjectWithProperties
	Implements 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(Of TResult)()

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

System_CAPS_pubmethodOfType(Of 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
    Implements IServerChannelSinkProvider 
    Private next2 As IServerChannelSinkProvider = Nothing

    Public Sub New(properties As IDictionary, providerData As ICollection)
    End Sub 'NewNew

    Public Sub GetChannelData(channelData As IChannelDataStore) _ 
                                Implements IServerChannelSinkProvider.GetChannelData
    End Sub 'GetChannelData

    Public Function CreateSink(channel1 As IChannelReceiver) As IServerChannelSink _ 
                                      Implements IServerChannelSinkProvider.CreateSink
       Dim localNextSink As IServerChannelSink = Nothing
       If Not (next2 Is Nothing) Then
          localNextSink = next2.CreateSink(channel1)
       End If
       Return New LoggingServerChannelSink(localNextSink)
    End Function 'CreateSink

    Public Property [Next]() As IServerChannelSinkProvider Implements _ 
                                                      IServerChannelSinkProvider.Next
       Get
          Return next2
       End Get
       Set
          next2 = value
       End Set
    End Property
 End Class 'LoggingServerChannelSinkProvider

 <PermissionSet(SecurityAction.Demand, Name:="FullTrust")> _ 
 Friend Class LoggingServerChannelSink
    Inherits BaseChannelObjectWithProperties
    Implements IServerChannelSink 
    Private nextSink2 As IServerChannelSink = Nothing
    Private bEnabled2 As Boolean = True

    Public Sub New(localNextSink As IServerChannelSink)
       MyBase.new()
       nextSink2 = localNextSink
    End Sub 'NewNew

   Public Function ProcessMessage(   ByVal sinkStack As IServerChannelSinkStack, _
       ByVal requestMsg As IMessage, _
       ByVal requestHeaders As ITransportHeaders, _
       ByVal requestStream As Stream, _
       <Out> ByRef responseMsg As IMessage, _
       <Out> ByRef responseHeaders As ITransportHeaders, _
       <Out> ByRef responseStream As Stream _
    ) As ServerProcessing _ 
       Implements IServerChannelSink.ProcessMessage
       If bEnabled2 Then
          Console.WriteLine("----------Request Headers-----------")
          Console.WriteLine(CommonTransportKeys.IPAddress.ToString() + ":" + _ 
                               requestHeaders(CommonTransportKeys.IPAddress).ToString())
       Console.WriteLine(CommonTransportKeys.ConnectionId.ToString() + ":" + _ 
                               requestHeaders(CommonTransportKeys.ConnectionId).ToString())
       Console.WriteLine(CommonTransportKeys.RequestUri.ToString() + ":" + _ 
                               requestHeaders(CommonTransportKeys.RequestUri).ToString())
       End If
       sinkStack.Push(Me, Nothing)
       Dim processing As ServerProcessing = _ 
                                    nextSink2.ProcessMessage _ 
                (sinkStack, requestMsg, requestHeaders, requestStream, responseMsg, responseHeaders, responseStream)

       Select Case processing
          Case ServerProcessing.Complete
                sinkStack.Pop(Me)
          Case ServerProcessing.OneWay
                sinkStack.Pop(Me)
          Case ServerProcessing.Async
                sinkStack.Store(Me, Nothing)
       End Select
       Return processing
    End Function 'ProcessMessage

    Public Sub AsyncProcessResponse(sinkStack As IServerResponseChannelSinkStack, _ 
            state As Object, msg As IMessage, headers As ITransportHeaders, stream1 As Stream) _ 
                                     Implements IServerChannelSink.AsyncProcessResponse
       sinkStack.AsyncProcessResponse(msg, headers, stream1)
    End Sub 'AsyncProcessResponse

    Public Function GetResponseStream(sinkStack As IServerResponseChannelSinkStack, _ 
                state As Object, msg As IMessage, headers As ITransportHeaders) As Stream _ 
                                     Implements IServerChannelSink.GetResponseStream
       Return Nothing
    End Function 'GetResponseStream

    Public ReadOnly Property NextChannelSink() As IServerChannelSink _ 
                                        Implements IServerChannelSink.NextChannelSink
       Get
          Return nextSink2
       End Get
    End Property

    Public Overrides ReadOnly Property Properties() As Collections.IDictionary _ 
                Implements IServerChannelSink.Properties
       Get
return nothing		
       End Get
    End Property
 End Class 'LoggingServerChannelSink

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: