Thursday, May 12, 2011

Workflow 4 Default types to designer initialization

Dependency Injection way overboard?

I've been reflectoring, googling, stackoverflowing for weeks and just now stumbled upon the attribute injector code that runs to give ForEachActivity and SequenceActivity a designer.

Why weren't these attributes placed on the classes themselves? I have no idea.

Point your reflector at System.Activities.Core.Presentation in %windir%\Microsoft.NET\Framework\(4 something)



It's in 



System.Activities.Core.Presentation.DesignerMetadata.Register();
//Sneak peak
{
  AttributeTableBuilder builder = new AttributeTableBuilder();
  builder.AddCustomAttributes(typeof(ActivityAction),
    new Attribute[] { new EditorReuseAttribute(false) });
  SequenceDesigner.RegisterMetadata(builder);
  ForEachDesigner.RegisterMetadata(builder);
}

No comments:

Post a Comment