NativeActivity<TResult>.CacheMetadata 方法
定义
创建并验证活动的自变量、变量、子活动和活动委托的说明。Creates and validates a description of the activity's arguments, variables, child activities, and activity delegates.
重载
| CacheMetadata(ActivityMetadata) |
未实现。Not implemented. 请改用 CacheMetadata(NativeActivityMetadata)。Use CacheMetadata(NativeActivityMetadata) instead. |
| CacheMetadata(NativeActivityMetadata) |
创建并验证活动的自变量、变量、子活动和活动委托的说明。Creates and validates a description of the activity's arguments, variables, child activities, and activity delegates. |
注解
自定义活动作者可以在活动的 CacheMetadata 重写中提供验证逻辑。Custom activity authors can provide validation logic in an activity's CacheMetadata override. 由 CacheMetadata 引发的任何异常不会视为验证错误。Any exceptions that are thrown from CacheMetadata are not treated as validation errors. 这些异常将从对 Validate 的调用中转义,并且必须由调用方进行处理。These exceptions will escape from the call to Validate and must be handled by the caller.
CacheMetadata(ActivityMetadata)
未实现。Not implemented. 请改用 CacheMetadata(NativeActivityMetadata)。Use CacheMetadata(NativeActivityMetadata) instead.
protected:
override void CacheMetadata(System::Activities::ActivityMetadata metadata);
protected override sealed void CacheMetadata (System.Activities.ActivityMetadata metadata);
override this.CacheMetadata : System.Activities.ActivityMetadata -> unit
Protected Overrides NotOverridable Sub CacheMetadata (metadata As ActivityMetadata)
参数
- metadata
- ActivityMetadata
未实现。Not implemented.
注解
自定义活动作者可以在活动的 CacheMetadata 重写中提供验证逻辑。Custom activity authors can provide validation logic in an activity's CacheMetadata override. 由 CacheMetadata 引发的任何异常不会视为验证错误。Any exceptions that are thrown from CacheMetadata are not treated as validation errors. 这些异常将从对 Validate 的调用中转义,并且必须由调用方进行处理。These exceptions will escape from the call to Validate and must be handled by the caller.
适用于
CacheMetadata(NativeActivityMetadata)
创建并验证活动的自变量、变量、子活动和活动委托的说明。Creates and validates a description of the activity's arguments, variables, child activities, and activity delegates.
protected:
virtual void CacheMetadata(System::Activities::NativeActivityMetadata metadata);
protected virtual void CacheMetadata (System.Activities.NativeActivityMetadata metadata);
override this.CacheMetadata : System.Activities.NativeActivityMetadata -> unit
Protected Overridable Sub CacheMetadata (metadata As NativeActivityMetadata)
参数
- metadata
- NativeActivityMetadata
活动的元数据,用于封装活动的自变量、变量、子活动和活动委托。The activity's metadata that encapsulates the activity's arguments, variables, child activities, and activity delegates.
示例
下面的代码示例演示如何在一个从 NativeActivity<TResult> 继承的类中使用 CacheMetadata。The following code sample demonstrates using CacheMetadata in a class that inherits from NativeActivity<TResult>. 此示例来自 使用本机活动示例的自定义复合 。This example is from the Custom Composite using Native Activity sample.
protected override void CacheMetadata(NativeActivityMetadata metadata)
{
//call base.CacheMetadata to add the Activities and Variables to this activity's metadata
base.CacheMetadata(metadata);
//add the private implementation variable: currentIndex
metadata.AddImplementationVariable(this.currentIndex);
}
注解
工作流运行时使用 CacheMetadata 的默认实现来确保工作流构造正确,以及管理运行时关系和生存期规则。The workflow runtime uses the default implementation of CacheMetadata to ensure correct construction of a workflow as well as to manage run-time relationships and lifetime rules. 的默认实现 CacheMetadata 使用类型的来检查活动类型的公共成员 TypeDescriptor 。The default implementation of CacheMetadata examines the public members of the activity type using the type's TypeDescriptor. 这些公共成员的类型为 Argument 、 Variable 、 IEnumerable <Variable> 、 Activity 、 IEnumerable <Activity> 或 ActivityDelegate 。These public members are of type Argument, Variable, IEnumerable<Variable>, Activity, IEnumerable<Activity>, or ActivityDelegate. 您可以重写此方法以自定义活动的运行时说明的生成,并提供自定义验证逻辑。You can override this method to customize the building of the activity's run-time description and to provide custom validation logic. 由 CacheMetadata 引发的任何异常不会视为验证错误。Any exceptions that are thrown from CacheMetadata are not treated as validation errors. 这些异常将从对 Validate 的调用中转义,并且必须由调用方进行处理。These exceptions will escape from the call to Validate and must be handled by the caller.