Share via


SoapServices.PreLoad 方法

定義

依據在套用至型別的 SoapTypeAttribute 中設定的值,預先載入指定的型別。

多載

PreLoad(Assembly)

從與每個型別關聯的 Type 找到的資訊中,預先載入在指定的 Assembly 中找到的每個 SoapTypeAttribute

PreLoad(Type)

依據型別的 Type 中所設定的值,預先載入指定的 SoapTypeAttribute

PreLoad(Assembly)

從與每個型別關聯的 Type 找到的資訊中,預先載入在指定的 Assembly 中找到的每個 SoapTypeAttribute

public:
 static void PreLoad(System::Reflection::Assembly ^ assembly);
public static void PreLoad (System.Reflection.Assembly assembly);
[System.Security.SecurityCritical]
public static void PreLoad (System.Reflection.Assembly assembly);
static member PreLoad : System.Reflection.Assembly -> unit
[<System.Security.SecurityCritical>]
static member PreLoad : System.Reflection.Assembly -> unit
Public Shared Sub PreLoad (assembly As Assembly)

參數

assembly
Assembly

要呼叫 Assembly 之每個型別的 PreLoad(Type)

屬性

例外狀況

立即呼叫端沒有基礎結構使用權限。

範例

下列程式碼範例會顯示如何使用這個方法。 此程式代碼範例是提供給 類別之較大範例的 SoapServices 一部分。

// Register all types in the assembly with the SoapType attribute.
System::Reflection::Assembly^ executingAssembly =
   System::Reflection::Assembly::GetExecutingAssembly();
SoapServices::PreLoad( executingAssembly );
// Register all types in the assembly with the SoapType attribute.
System.Reflection.Assembly executingAssembly =
    System.Reflection.Assembly.GetExecutingAssembly();
SoapServices.PreLoad(executingAssembly);

備註

當 .NET Framework 剖析 XML 數據流時,它必須知道如何將從數據流讀取的 XML 轉換成 Common Language Runtime 類型。 指定 .NET Framework 產生和剖析 XML 資料流如何儲存在命名空間中的System.Runtime.Remoting.Metadata自訂屬性中的資訊。 在組態檔中指定這項資訊的方法有兩種:藉由明確指定對應,或指定要預先載入的物件類型。 自定義屬性會在預先載入程式期間讀取,而且這些屬性中的資訊可供SOAP剖析器使用。

適用於

PreLoad(Type)

依據型別的 Type 中所設定的值,預先載入指定的 SoapTypeAttribute

public:
 static void PreLoad(Type ^ type);
public static void PreLoad (Type type);
[System.Security.SecurityCritical]
public static void PreLoad (Type type);
static member PreLoad : Type -> unit
[<System.Security.SecurityCritical>]
static member PreLoad : Type -> unit
Public Shared Sub PreLoad (type As Type)

參數

type
Type

要預先載入的 Type

屬性

例外狀況

立即呼叫端沒有基礎結構使用權限。

範例

下列程式碼範例會顯示如何使用這個方法。 此程式代碼範例是提供給 類別之較大範例的 SoapServices 一部分。

// Register a specific type with the SoapType attribute.
Type^ exampleType = ExampleNamespace::ExampleClass::typeid;
SoapServices::PreLoad( exampleType );
// Register a specific type with the SoapType attribute.
Type exampleType = typeof(ExampleNamespace.ExampleClass);
SoapServices.PreLoad(exampleType);

備註

當 .NET Framework 剖析 XML 數據流時,它必須知道如何將從數據流讀取的 XML 轉換成 Common Language Runtime 類型。 指定 .NET Framework 產生和剖析 XML 資料流如何儲存在命名空間中的System.Runtime.Remoting.Metadata自訂屬性中的資訊。 在組態檔中指定這項資訊的方法有兩種:藉由明確指定對應,或指定要預先載入的物件類型。 自定義屬性會在預先載入程式期間讀取,而且這些屬性中的資訊可供SOAP剖析器使用。

適用於