ActivationArguments 类

定义

为应用程序的基于清单的激活提供数据。Provides data for manifest-based activation of an application. 此类不能被继承。This class cannot be inherited.

public ref class ActivationArguments sealed : System::Security::Policy::EvidenceBase
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public sealed class ActivationArguments : System.Security.Policy.EvidenceBase
type ActivationArguments = class
    inherit EvidenceBase
Public NotInheritable Class ActivationArguments
Inherits EvidenceBase
继承
ActivationArguments
属性

示例

下面的代码示例演示如何ActivationArguments AppDomainSetupAppDomain基于清单的应用程序的获取的当前对象。The following code example shows how to obtain the current ActivationArguments object from the AppDomainSetup for the AppDomain of a manifest-based application.

using System;
using System.Collections;
using System.Text;
using System.Security.Policy;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Runtime.Hosting;

namespace ActivationContextSample
{
    public class Program : MarshalByRefObject
    {
        [SecurityPermission(SecurityAction.LinkDemand, ControlDomainPolicy=true)]
        public static void Main(string[] args)
        {
            // Get the AppDomainManager from the current domain.
            AppDomainManager domainMgr = AppDomain.CurrentDomain.DomainManager;
            // Get the ApplicationActivator from the AppDomainManager.
            ApplicationActivator appActivator = domainMgr.ApplicationActivator;
            Console.WriteLine("Assembly qualified name from the application activator.");
            Console.WriteLine(appActivator.GetType().AssemblyQualifiedName);
            // Get the ActivationArguments from the SetupInformation property of the domain.
            ActivationArguments activationArgs = AppDomain.CurrentDomain.SetupInformation.ActivationArguments;
            // Get the ActivationContext from the ActivationArguments.
            ActivationContext actContext = activationArgs.ActivationContext;
            Console.WriteLine("The ActivationContext.Form property value is: " +
                activationArgs.ActivationContext.Form);
            Console.Read();
        }
    [SecurityPermission(SecurityAction.LinkDemand, ControlDomainPolicy=true)]
        public void Run()
        {
            Main(new string[] { });
            Console.ReadLine();
        }
    }
}
Imports System.Collections
Imports System.Text
Imports System.Security.Policy
Imports System.Reflection
Imports System.Security
Imports System.Security.Permissions
Imports System.Runtime.Hosting



Public Class Program
    Inherits MarshalByRefObject

    <SecurityPermission(SecurityAction.LinkDemand, ControlDomainPolicy:=True)> _
    Public Shared Sub Main(ByVal args() As String)
        ' Get the AppDomainManager from the current domain.
        Dim domainMgr As AppDomainManager = AppDomain.CurrentDomain.DomainManager
        ' Get the ApplicationActivator from the AppDomainManager.
        Dim appActivator As ApplicationActivator = domainMgr.ApplicationActivator
        Console.WriteLine("Assembly qualified name from the application activator.")
        Console.WriteLine(appActivator.GetType().AssemblyQualifiedName)
        Dim ac As ActivationContext = AppDomain.CurrentDomain.ActivationContext
        ' Get the ActivationArguments from the SetupInformation property of the domain.
        Dim activationArgs As ActivationArguments = AppDomain.CurrentDomain.SetupInformation.ActivationArguments
        ' Get the ActivationContext from the ActivationArguments.
        Dim actContext As ActivationContext = activationArgs.ActivationContext
        Console.WriteLine("The ActivationContext.Form property value is: " + _
         activationArgs.ActivationContext.Form.ToString())
        Console.Read()

    End Sub

    <SecurityPermission(SecurityAction.LinkDemand, ControlDomainPolicy:=True)> _
    Public Sub Run()
        Main(New String() {})
        Console.ReadLine()

    End Sub
End Class

注解

类由AppDomainSetup类使用。 ActivationArgumentsThe ActivationArguments class is used by the AppDomainSetup class.

基于清单的激活模型使用应用程序清单而不是程序集进行激活。The manifest-based activation model uses an application manifest rather than an assembly for activation. 清单完全描述了应用程序及其依赖关系、安全要求等。A manifest fully describes the application, its dependencies, security requirements, and so forth. 与基于程序集的激活模型相比, 清单模型具有多个优点, 特别是对于 Web 应用程序。The manifest model has several advantages over the assembly-based activation model, especially for Web applications. 例如, 清单包含应用程序的安全要求, 使用户能够决定是否允许应用程序在下载代码之前执行。For example, the manifest contains the security requirements of the application, which enables the user to decide whether to allow the application to execute before downloading the code. 清单还包含有关应用程序依赖关系的信息。The manifest also contains information about the application dependencies.

构造函数

ActivationArguments(ActivationContext)

用指定的激活上下文初始化 ActivationArguments 类的新实例。Initializes a new instance of the ActivationArguments class with the specified activation context.

ActivationArguments(ActivationContext, String[])

用指定的激活上下文和激活数据初始化 ActivationArguments 类的新实例。Initializes a new instance of the ActivationArguments class with the specified activation context and activation data.

ActivationArguments(ApplicationIdentity)

使用指定的应用程序标识初始化 ActivationArguments 类的新实例。Initializes a new instance of the ActivationArguments class with the specified application identity.

ActivationArguments(ApplicationIdentity, String[])

用指定的应用程序标识和激活数据初始化 ActivationArguments 类的新实例。Initializes a new instance of the ActivationArguments class with the specified application identity and activation data.

属性

ActivationContext

为应用程序获取基于清单的激活的激活上下文。Gets the activation context for manifest-based activation of an application.

ActivationData

从宿主获取激活数据。Gets activation data from the host.

ApplicationIdentity

为清单激活的应用程序获取应用程序标识。Gets the application identity for a manifest-activated application.

方法

Clone()

生成当前 ActivationArguments 对象的副本。Produces a copy of the current ActivationArguments object.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于