Metadata Store Programmability

This topic applies to Windows Workflow Foundation 4 (WF4).

The metadata store is a Windows Workflow Designer feature that allows for the association of arbitrary metadata, in the form of CLR attributes, to types at runtime. This allows for a loose coupling between the run-time components and their design-time counterparts, as well as the ability to change the design-time components without affecting the runtime. The sample shows how to program against the metadata store by applying attributes to a run-time type, the source for which we have no control over. The terminology typically used is that a hosting application registers the metadata for a set of types.

Within the output, you may notice an additional, unexpected attribute, GUIDAttribute. This is added when using the Metadata API and has no impact on the running of the sample.

This sample demonstrates:

Demonstrates

  • Attribute injection using the metadata store API.

  • Using a callback mechanism to defer metadata registration.

To set up, build, and run the sample

  1. Using Visual Studio 2010, open the ProgrammingMetadataStore.sln solution file.

  2. To build the solution, press CTRL+SHIFT+B.

  3. To run the solution, press F5.

Dd807501.Important(en-us,VS.100).gif Note:
The samples may already be installed on your computer. Check for the following (default) directory before continuing.

<InstallDrive>:\WF_WCF_Samples

If this directory does not exist, go to Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4 to download all Windows Communication Foundation (WCF) and WF samples. This sample is located in the following directory.

<InstallDrive>:\WF_WCF_Samples\WF\Basic\CustomActivities\CustomActivityDesigners\MetadataStore