AddInToken.EnableDirectConnect 属性


获取或设置一个值,该值指示在条件允许时外接程序是否应直接连接到它们的宿主。Gets or sets a value that indicates whether add-ins should be directly connected to their hosts when conditions permit.

 static property bool EnableDirectConnect { bool get(); void set(bool value); };
public static bool EnableDirectConnect { get; set; }
member this.EnableDirectConnect : bool with get, set
Public Shared Property EnableDirectConnect As Boolean


如果外接程序应该直接连接到宿主,则为 true;否则为 falsetrue if the add-in should be directly connected to the host; otherwise, false. 默认值为 falseThe default is false.


若要进行直接连接, 必须满足以下条件:The following conditions must exist for the direct connection to occur:

  • 此属性必须设置为trueThis property must be set to true.

  • 外接程序必须与主机位于同一个应用程序域中。The add-in must be in the same application domain as the host.

  • 外接程序视图和外接程序的宿主视图必须具有相同的类型。The add-in view and the host view of the add-in must be the same type.

  • 管道的所有段都必须可用。All the segments of the pipeline must be available.

建立直接连接后, 不会实例化外接程序端适配器和主机端适配器。When a direct connection is established, the add-in-side adapter and the host-side adapter are not instantiated.