RemotingServices.IsObjectOutOfContext(Object) Metoda

Definicja

Zwraca wartość logiczną wskazującą, czy obiekt reprezentowany przez dany serwer proxy jest zawarty w innym kontekście niż obiekt, który nazwał bieżącą metodę.

public:
 static bool IsObjectOutOfContext(System::Object ^ tp);
public static bool IsObjectOutOfContext (object tp);
static member IsObjectOutOfContext : obj -> bool
Public Shared Function IsObjectOutOfContext (tp As Object) As Boolean

Parametry

tp
Object

Obiekt do sprawdzenia.

Zwraca

true jeśli obiekt jest poza bieżącym kontekstem; w przeciwnym razie , false.

Przykłady

// Create a remote version of TempConverter::Converter.
TempConverter::Converter^ converter1 =
      dynamic_cast<TempConverter::Converter^>(Activator::GetObject(
      TempConverter::Converter::typeid,
      "http://localhost:8085/TempConverter" ));

// Create a local version of TempConverter::Converter.
TempConverter::Converter^ converter2 = gcnew TempConverter::Converter;

// Returns true, converter1 is remote and in a different appdomain.
System::Runtime::Remoting::RemotingServices::IsObjectOutOfAppDomain( converter1 );

// Returns false, converter2 is local and running in this appdomain.
System::Runtime::Remoting::RemotingServices::IsObjectOutOfAppDomain( converter2 );

// Returns true, converter1 is remote and in a different context.
System::Runtime::Remoting::RemotingServices::IsObjectOutOfContext( converter1 );

// Returns false, converter2 is local and running in this context.
System::Runtime::Remoting::RemotingServices::IsObjectOutOfContext( converter2 );
// Create a remote version of TempConverter.Converter.
TempConverter.Converter converter1 =
        (TempConverter.Converter) Activator.GetObject(
        typeof(TempConverter.Converter),
        "http://localhost:8085/TempConverter");

// Create a local version of TempConverter.Converter.
TempConverter.Converter converter2 = new TempConverter.Converter();

// Returns true, converter1 is remote and in a different appdomain.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfAppDomain(
                        converter1);

// Returns false, converter2 is local and running in this appdomain.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfAppDomain(
                        converter2);

// Returns true, converter1 is remote and in a different context.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfContext(
                        converter1);

// Returns false, converter2 is local and running in this context.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfContext(
                        converter2);
' Create remote version of TempConverter.Converter.
Dim converter1 As TempConverter.Converter

converter1 = CType(Activator.GetObject(GetType( _
                     TempConverter.Converter), _
                     "http://localhost:8085/TempConverter"), _
                     TempConverter.Converter)
' Create local version of TempConverter.Converter.
Dim converter2 As New TempConverter.Converter()

' Returns true, converter1 is remote and in a different appdomain.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfAppDomain( _
                                                   converter1)

' Returns false, converter2 is local and running in this appdomain.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfAppDomain( _
                                                   converter2)

' Returns true, converter1 is remote and in a different context.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfContext( _
                                                   converter1)

' Returns false, converter2 is local and running in this context.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfContext( _
                                                   converter2)

Uwagi

Kontekst to uporządkowana sekwencja właściwości definiujących środowisko dla obiektów znajdujących się w nim. Konteksty są tworzone podczas procesu aktywacji dla obiektów skonfigurowanych tak, aby wymagały niektórych usług automatycznych, takich jak synchronizacja, transakcje, aktywacja just in time, zabezpieczenia itd. Wiele obiektów może żyć wewnątrz kontekstu.

Dotyczy

Zobacz też