Skip to content

Instantly share code, notes, and snippets.

@koistya
Created October 4, 2012 08:17
Show Gist options
  • Select an option

  • Save koistya/3832162 to your computer and use it in GitHub Desktop.

Select an option

Save koistya/3832162 to your computer and use it in GitHub Desktop.
Service locator in Windows Workflow Foundation
public sealed class SampleActivity : CodeActivity
{
protected override void CacheMetadata(CodeActivityMetadata metadata)
{
// Require the IDatabaseContext extension to be defined in the workflow host application.
// The workflow will fail validation if an extension with this interface is not provided.
metadata.RequireExtension<IDatabaseContext>();
}
protected override void Execute(CodeActivityContext context)
{
var db = context.GetExtension<IDatabaseContext>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment