MattHoneycutt / Fail-Tracker

Fail Tracker is an agile issue tracking system written with ASP.NET MVC.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IRegistrationconvention Process (v. 3) vs. ScanTypes (v. 4)

mattdunndc opened this issue · comments

Hi Matt,

The latest version of StructureMap implements Process in the ControllerConvention class.
How do I implement Scantypes(TypeSet types, Registry registry) with the newest version of StructureMap?

Thanks in advance.

Something like this...

public void ScanTypes(TypeSet types, Registry registry)
{
// Only work on concrete types
types.FindTypes(TypeClassification.Concretes | TypeClassification.Closed).Each(type =>
{
// Register against all the interfaces implemented
// by this concrete class
type.GetInterfaces().Each(@interface => registry.For(@interface).Use(type));
});
}

Here's an updated ControllerConvention class from the Heroic.Web.IoC framework: https://github.com/MattHoneycutt/HeroicFramework/blob/master/Heroic.Web.IoC/ControllerConvention.cs

I hope that helps!