Metodo NativeActivity<TResult>.CacheMetadata (NativeActivityMetadata)

.NET Framework (current version)

Crea e convalida una descrizione degli argomenti dell'attività, delle variabili, delle attività figlio e dei delegati di attività.

Spazio dei nomi:   System.Activities
Assembly:  System.Activities (in System.Activities.dll)

protected virtual void CacheMetadata(
	NativeActivityMetadata metadata


Type: System.Activities.NativeActivityMetadata

I metadati dell'attività che incapsulano gli argomenti dell'attività, le variabili, le attività figlio e i delegati di attività.

The workflow runtime uses the default implementation of M:System.Activities.NativeActivity`1.CacheMetadata(System.Activities.NativeActivityMetadata) to ensure correct construction of a workflow as well as to manage run-time relationships and lifetime rules. The default implementation of M:System.Activities.NativeActivity`1.CacheMetadata(System.Activities.NativeActivityMetadata) examines the public members of the activity type using the type’s T:System.ComponentModel.TypeDescriptor. These public members are of type T:System.Activities.Argument, T:System.Activities.Variable, T:System.Collections.Generic.IEnumerable<T:System.Activities.Variable>, T:System.Activities.Activity, T:System.Collections.Generic.IEnumerable<T:System.Activities.Activity>, or T:System.Activities.ActivityDelegate. You can override this method to customize the building of the activity’s run-time description and to provide custom validation logic. Any exceptions that are thrown from M:System.Activities.NativeActivity`1.CacheMetadata(System.Activities.NativeActivityMetadata) are not treated as validation errors. These exceptions will escape from the call to M:System.Activities.Validation.ActivityValidationServices.Validate(System.Activities.Activity) and must be handled by the caller.

The following code sample demonstrates using CacheMetadata in a class that inherits from T:System.Activities.NativeActivity`1. 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
    //add the private implementation variable: currentIndex 

.NET Framework
Disponibile da 4.0
Torna all'inizio