SoapServices.PreLoad 方法

定義

預載指定類型時,會根據套用到 SoapTypeAttribute 的值來設定。

多載

名稱 Description
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 轉換成通用的執行時語言類型。 指定 .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 轉換成通用的執行時語言類型。 指定 .NET Framework 如何產生與解析 XML 串流的資訊,儲存在位於 System.Runtime.Remoting.Metadata 命名空間中的自訂屬性中。 在設定檔中指定這些資訊有兩種方式:一是明確指定映射,二是指定要預載哪些物件類型。 自訂屬性會在預載入過程中被讀取,並將其中的資訊提供給 SOAP 解析器。

適用於