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,
System.Runtime.InteropServices.GUIDAttribute. This is added when using the Metadata API and has no impact on the running of the sample.
This sample demonstrates:
Attribute injection using the metadata store API.
Using a callback mechanism to defer metadata registration.
To set up, build, and run the sample
Using Visual Studio 2010, open the ProgrammingMetadataStore.sln solution file.
To build the solution, press CTRL+SHIFT+B.
To run the solution, press F5.
The samples may already be installed on your machine. Check for the following (default) directory before continuing.
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.