SynchronizationAttribute 클래스

정의

현재 컨텍스트 및 같은 인스턴스를 공유하는 모든 컨텍스트에 동기화 도메인을 적용합니다.

public ref class SynchronizationAttribute : System::Runtime::Remoting::Contexts::ContextAttribute, System::Runtime::Remoting::Contexts::IContributeClientContextSink, System::Runtime::Remoting::Contexts::IContributeServerContextSink
[System.AttributeUsage(System.AttributeTargets.Class)]
[System.Serializable]
public class SynchronizationAttribute : System.Runtime.Remoting.Contexts.ContextAttribute, System.Runtime.Remoting.Contexts.IContributeClientContextSink, System.Runtime.Remoting.Contexts.IContributeServerContextSink
[System.AttributeUsage(System.AttributeTargets.Class)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class SynchronizationAttribute : System.Runtime.Remoting.Contexts.ContextAttribute, System.Runtime.Remoting.Contexts.IContributeClientContextSink, System.Runtime.Remoting.Contexts.IContributeServerContextSink
[System.AttributeUsage(System.AttributeTargets.Class)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Security.SecurityCritical]
public class SynchronizationAttribute : System.Runtime.Remoting.Contexts.ContextAttribute, System.Runtime.Remoting.Contexts.IContributeClientContextSink, System.Runtime.Remoting.Contexts.IContributeServerContextSink
[<System.AttributeUsage(System.AttributeTargets.Class)>]
[<System.Serializable>]
type SynchronizationAttribute = class
    inherit ContextAttribute
    interface IContributeServerContextSink
    interface IContributeClientContextSink
[<System.AttributeUsage(System.AttributeTargets.Class)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type SynchronizationAttribute = class
    inherit ContextAttribute
    interface IContributeServerContextSink
    interface IContributeClientContextSink
[<System.AttributeUsage(System.AttributeTargets.Class)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Security.SecurityCritical>]
type SynchronizationAttribute = class
    inherit ContextAttribute
    interface IContributeServerContextSink
    interface IContributeClientContextSink
[<System.AttributeUsage(System.AttributeTargets.Class)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type SynchronizationAttribute = class
    inherit ContextAttribute
    interface IContributeClientContextSink
    interface IContributeServerContextSink
Public Class SynchronizationAttribute
Inherits ContextAttribute
Implements IContributeClientContextSink, IContributeServerContextSink
상속
SynchronizationAttribute
특성
구현

예제

다음 코드 예제에서는 SynchronizationAttribute합니다. 전체 예제 코드에 대 한 예제를 참조 하세요.를 AsyncResult 클래스입니다.

// Context-bound type with the Synchronization context attribute.

[Synchronization]
public ref class SampleSynchronized: public ContextBoundObject
{
public:

   // A method that does some work, and returns the square of the given number.
   int Square( int i )
   {
      Console::Write( "The hash of the thread executing " );
      Console::WriteLine( "SampleSynchronized::Square is: {0}", Thread::CurrentThread->GetHashCode() );
      return i * i;
   }

};
// Context-bound type with the Synchronization context attribute.
[Synchronization()]
public class SampleSynchronized : ContextBoundObject {

    // A method that does some work, and returns the square of the given number.
    public int Square(int i)  {

        Console.Write("The hash of the thread executing ");
        Console.WriteLine("SampleSynchronized.Square is: {0}",
                             Thread.CurrentThread.GetHashCode());
        return i*i;
    }
}
' Context-bound type with the Synchronization context attribute.
<Synchronization()> Public Class SampleSynchronized
   Inherits ContextBoundObject
   
   ' A method that does some work, and returns the square of the given number.
   Public Function Square(i As Integer) As Integer
      
      Console.Write("The hash of the thread executing ")
      Console.WriteLine("SampleSynchronized.Square is: {0}", Thread.CurrentThread.GetHashCode())
      Return i * i
   End Function 

End Class

설명

이 특성은 개체에 적용 되 면이 속성의 인스턴스를 공유 하는 모든 컨텍스트에서 하나의 스레드만 실행 중일 수 있습니다. 가로채 고 해당 컨텍스트에 대 한 들어오는 호출을 serialize 하는 싱크를 제공 하면 됩니다. 속성은 재진입에 대해 표시 되 면 설명선 너무 가로채 집니다. 설명선 인터 셉 션 다른 대기 스레드가 최대 처리량에 대 한 동기화 도메인을 입력할 수 있습니다.

참고

두 가지 방법으로 명명 된 SynchronizationAttribute :에서 하나를 System.Runtime.Remoting.Contexts 네임 스페이스에 있고 다른는 System.EnterpriseServices 네임 스페이스. System.EnterpriseServices.SynchronizationAttribute 동기 호출만 지원 클래스 및 서비스 구성 요소 에서만 사용할 수 있습니다. System.Runtime.Remoting.Contexts.SynchronizationAttribute 동기 및 비동기 호출을 모두 지원하며 컨텍스트 바인딩된 개체에서만 사용할 수 있습니다. (컨텍스트에 대 한 자세한 정보 바인딩된 개체에 대 한 참조를 ContextBoundObject 클래스입니다.)

참고

이 클래스는 클래스 수준에서 상속 요청과 링크 요청을 만듭니다. SecurityException 직접 실행 호출자 또는 파생된 클래스 중 하나에 인프라 권한이 없는 경우 throw 됩니다. 보안 요청에 대 한 자세한 내용은 참조 하세요 링크 요청 하 고 상속 요청합니다.

생성자

SynchronizationAttribute()

기본값을 사용하여 SynchronizationAttribute 클래스의 새 인스턴스를 초기화합니다.

SynchronizationAttribute(Boolean)

재진입이 필요한지 여부를 나타내는 부울 값을 사용하여 SynchronizationAttribute 클래스의 새 인스턴스를 초기화합니다.

SynchronizationAttribute(Int32)

이 특성이 적용되는 개체의 동작을 나타내는 플래그를 사용하여 SynchronizationAttribute 클래스의 새 인스턴스를 초기화합니다.

SynchronizationAttribute(Int32, Boolean)

이 특성이 적용되는 개체의 동작을 나타내는 플래그와 재진입이 필요한지 여부를 나타내는 부울 값을 사용하여 SynchronizationAttribute 클래스의 새 인스턴스를 초기화합니다.

필드

AttributeName

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

컨텍스트 특성의 이름을 나타냅니다.

(다음에서 상속됨 ContextAttribute)
NOT_SUPPORTED

동기화가 포함된 컨텍스트에서는 이 특성이 적용되는 클래스를 만들 수 없음을 나타냅니다. 이 필드는 상수입니다.

REQUIRED

동기화가 포함된 컨텍스트에서는 이 특성이 적용되는 클래스를 만들어야 함을 나타냅니다. 이 필드는 상수입니다.

REQUIRES_NEW

동기화 속성의 새 인스턴스가 있는 컨텍스트마다 이 특성이 적용되는 클래스를 만들어야 함을 나타냅니다. 이 필드는 상수입니다.

SUPPORTED

이 특성이 적용되는 클래스는 컨텍스트에 동기화가 포함되어 있는지 여부와 관계가 없음을 나타냅니다. 이 필드는 상수입니다.

속성

IsReEntrant

재진입이 필요한지 여부를 나타내는 부울 값을 가져오거나 설정합니다.

Locked

Context의 이 인스턴스를 구현하는 SynchronizationAttribute가 잠겨 있는지 여부를 나타내는 부울 값을 가져오거나 설정합니다.

Name

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

컨텍스트 특성의 이름을 가져옵니다.

(다음에서 상속됨 ContextAttribute)
TypeId

파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다.

(다음에서 상속됨 Attribute)

메서드

Equals(Object)

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 부울 값을 반환합니다.

(다음에서 상속됨 ContextAttribute)
Freeze(Context)

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

컨텍스트가 고정될 때 호출됩니다.

(다음에서 상속됨 ContextAttribute)
GetClientContextSink(IMessageSink)

외부 호출 싱크를 만들어 원격 호출의 클라이언트 끝에 있는 컨텍스트 경계에 제공된 싱크 체인 앞에 이 싱크를 연결합니다.

GetHashCode()

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

ContextAttribute 인스턴스에 대한 해시 코드를 반환합니다.

(다음에서 상속됨 ContextAttribute)
GetPropertiesForNewContext(IConstructionCallMessage)

Synchronized 컨텍스트 속성을 지정된 IConstructionCallMessage에 추가합니다.

GetServerContextSink(IMessageSink)

동기화된 디스패치 싱크를 만들어 원격 호출의 서버 끝에 있는 컨텍스트 경계에 제공된 싱크 체인 앞에 이 싱크를 연결합니다.

GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IsContextOK(Context, IConstructionCallMessage)

컨텍스트 매개 변수가 컨텍스트 특성의 요구 사항을 충족시키는지 여부를 나타내는 부울 값을 반환합니다.

IsDefaultAttribute()

파생 클래스에서 재정의된 경우 이 인스턴스 값이 파생 클래스에 대한 기본값인지 여부를 표시합니다.

(다음에서 상속됨 Attribute)
IsNewContextOK(Context)

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

컨텍스트 속성이 새 컨텍스트와 호환되는지 여부를 나타내는 부울 값을 반환합니다.

(다음에서 상속됨 ContextAttribute)
Match(Object)

파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

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

현재 Object의 단순 복사본을 만듭니다.

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

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에서 노출하는 메서드와 속성에 대한 액세스를 제공합니다.

(다음에서 상속됨 Attribute)

적용 대상