Skip to content

Instantly share code, notes, and snippets.

@Pondidum
Last active August 29, 2015 14:00
Show Gist options
  • Select an option

  • Save Pondidum/11462998 to your computer and use it in GitHub Desktop.

Select an option

Save Pondidum/11462998 to your computer and use it in GitHub Desktop.
Structuremap Factory Configuration
public class InternalRegistry : Registry
{
public InternalRegistry()
{
Scan(s =>
{
s.TheCallingAssembly();
s.WithDefaultConventions();
s.AddAllTypesOf<IViewRenderer>();
});
For<ViewRendererFactory>()
.Use(x => new ViewRendererFactory(x.GetAllInstances<IViewRenderer>()));
}
}
public class ViewRendererFactory
{
private readonly IEnumerable<IViewRenderer> _renderers;
public ViewRendererFactory(IEnumerable<IViewRenderer> renderers)
{
_renderers = renderers;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment