BaseChannelObjectWithProperties 클래스

정의

해당 속성에 대한 사전 인터페이스를 노출하는 채널 개체의 기본 구현을 제공합니다.Provides a base implementation of a channel object that exposes a dictionary interface to its properties.

public ref class BaseChannelObjectWithProperties abstract : System::Collections::IDictionary
[System.Runtime.InteropServices.ComVisible(true)]
[System.Security.SecurityCritical]
public abstract class BaseChannelObjectWithProperties : System.Collections.IDictionary
type BaseChannelObjectWithProperties = class
    interface IDictionary
    interface ICollection
    interface IEnumerable
Public MustInherit Class BaseChannelObjectWithProperties
Implements IDictionary
상속
BaseChannelObjectWithProperties
파생
특성
구현

예제

   [PermissionSet(SecurityAction::Demand, Name="FullTrust")]
   private ref class LoggingServerChannelSink: public BaseChannelObjectWithProperties, public IServerChannelSink
   {
   private:
      IServerChannelSink^ nextSink2;
      bool bEnabled2;

   public:
      LoggingServerChannelSink()
         : nextSink2( nullptr ), bEnabled2( true )
      {}

      LoggingServerChannelSink( IServerChannelSink^ localNextSink )
         : BaseChannelObjectWithProperties()
      {
         nextSink2 = localNextSink;
      }

      virtual ServerProcessing ProcessMessage( IServerChannelSinkStack^ sinkStack, IMessage^ requestMsg, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]IMessage^% responseMsg, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) = IServerChannelSink::ProcessMessage
      {
         if ( bEnabled2 )
         {
            Console::WriteLine( "----------Request Headers-----------" );
            
            Console::WriteLine( "{0}:{1}", CommonTransportKeys::IPAddress,
               requestHeaders[ CommonTransportKeys::IPAddress ] );
            Console::WriteLine( "{0}:{1}", CommonTransportKeys::ConnectionId,
               requestHeaders[ CommonTransportKeys::ConnectionId ] );
            Console::WriteLine( "{0}:{1}", CommonTransportKeys::RequestUri,
               requestHeaders[ CommonTransportKeys::RequestUri ] );
         }

         sinkStack->Push( this, nullptr );
         ServerProcessing processing = nextSink2->ProcessMessage( sinkStack, requestMsg, requestHeaders, requestStream, responseMsg, responseHeaders, responseStream );
         switch ( processing )
         {
            case ServerProcessing::Complete:
               sinkStack->Pop( this );
               break;

            case ServerProcessing::OneWay:
               sinkStack->Pop( this );
               break;

            case ServerProcessing::Async:
               sinkStack->Store( this, nullptr );
               break;
         }
         return processing;
      }

      virtual void AsyncProcessResponse( IServerResponseChannelSinkStack^ sinkStack, Object^ /*state*/, IMessage^ msg, ITransportHeaders^ headers, Stream^ stream1 )
      {
         sinkStack->AsyncProcessResponse( msg, headers, stream1 );
      }

      virtual Stream^ GetResponseStream( IServerResponseChannelSinkStack^ /*sinkStack*/, Object^ /*state*/, IMessage^ /*msg*/, ITransportHeaders^ /*headers*/ )
      {
         return nullptr;
      }

      property IServerChannelSink^ NextChannelSink 
      {
         virtual IServerChannelSink^ get()
         {
            return nextSink2;
         }
      }
   };

   [PermissionSet(SecurityAction::Demand, Name="FullTrust")]
   public ref class LoggingServerChannelSinkProvider: public IServerChannelSinkProvider
   {
   private:
      IServerChannelSinkProvider^ next2;

   public:
      LoggingServerChannelSinkProvider()
         : next2( nullptr )
      {}

      LoggingServerChannelSinkProvider( IDictionary^ /*properties*/, ICollection^ /*providerData*/ ){}

      virtual void GetChannelData( IChannelDataStore^ /*channelData*/ ){}

      virtual IServerChannelSink^ CreateSink( IChannelReceiver^ channel1 )
      {
         IServerChannelSink^ localNextSink = nullptr;
         if ( next2 != nullptr )
                  localNextSink = next2->CreateSink( channel1 );

         return gcnew LoggingServerChannelSink( localNextSink );
      }

      property IServerChannelSinkProvider^ Next 
      {
         virtual IServerChannelSinkProvider^ get()
         {
            return next2;
         }

         virtual void set( IServerChannelSinkProvider^ value )
         {
            next2 = value;
         }
      }
   };
}
   [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;
         }
      }
   }
<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
   
   Public Sub GetChannelData(channelData As IChannelDataStore) _ 
                               Implements IServerChannelSinkProvider.GetChannelData
   End Sub
   
   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

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

설명

BaseChannelObjectWithProperties 에 대 한 기본 클래스인 BaseChannelWithPropertiesBaseChannelSinkWithProperties입니다.BaseChannelObjectWithProperties is the base class for BaseChannelWithProperties and BaseChannelSinkWithProperties.

BaseChannelWithPropertiesBaseChannelSinkWithProperties 명명 된 속성의 채널 및 채널 싱크를 제공 하는 기본 클래스를 사용할 수 있습니다.BaseChannelWithProperties and BaseChannelSinkWithProperties can be used as the base classes for channels and channel sinks that provide named properties.

BaseChannelObjectWithProperties 채널 개체 속성과 묻는 복잡 한 작업을 처리 합니다.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. SecurityException 직접 실행 호출자 또는 파생된 클래스 중 하나에 인프라 권한이 없는 경우 throw 됩니다.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.

상속자 참고

상속 하는 경우 BaseChannelObjectWithProperties를 재정의 해야 합니다 Keys 속성 및 Item[Object] 속성입니다.When you inherit from BaseChannelObjectWithProperties, you must override the Keys property and the Item[Object] property.

생성자

BaseChannelObjectWithProperties()

BaseChannelObjectWithProperties 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the BaseChannelObjectWithProperties class.

속성

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

파생 클래스에서 재정의될 때 채널 개체 속성과 관련된 키의 ICollection을 가져옵니다.When overridden in a derived class, gets a ICollection of keys that the channel object properties are associated with.

Properties

채널 개체와 관련된 채널 속성의 IDictionary를 가져옵니다.Gets a IDictionary of the channel properties associated with the channel object.

SyncRoot

BaseChannelObjectWithProperties에 대한 액세스를 동기화하는 데 사용되는 개체를 가져옵니다.Gets an object that is used to synchronize access to the BaseChannelObjectWithProperties.

Values

채널 개체와 관련된 속성 값의 ICollection을 가져옵니다.Gets a ICollection of the values of the properties associated with the channel object.

메서드

Add(Object, Object)

NotSupportedException를 throw합니다.Throws a NotSupportedException.

Clear()

NotSupportedException를 throw합니다.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)

NotSupportedException를 throw합니다.Throws a NotSupportedException.

Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.Determines whether the specified object is equal to the current object.

(다음에서 상속됨 Object)
GetEnumerator()

채널 개체와 관련된 모든 속성에 대해 열거하는 IDictionaryEnumerator를 반환합니다.Returns a IDictionaryEnumerator that enumerates over all the properties associated with the channel object.

GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(다음에서 상속됨 Object)
Remove(Object)

NotSupportedException를 throw합니다.Throws a NotSupportedException.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

IEnumerable.GetEnumerator()

채널 개체와 관련된 모든 속성에 대해 열거하는 IEnumerator를 반환합니다.Returns a IEnumerator that enumerates over all the properties that are associated with the channel object.

확장 메서드

Cast<TResult>(IEnumerable)

IEnumerable의 요소를 지정된 형식으로 캐스팅합니다.Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

지정된 형식에 따라 IEnumerable의 요소를 필터링합니다.Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

쿼리를 병렬화할 수 있도록 합니다.Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerableIQueryable로 변환합니다.Converts an IEnumerable to an IQueryable.

보안

SecurityPermission
한 인프라 코드를 사용 하 여 작동 합니다.For operating with infrastructure code. 요청 값: InheritanceDemand; 권한 값: InfrastructureDemand value: InheritanceDemand; Permission value: Infrastructure

적용 대상