Skip to content

Instantly share code, notes, and snippets.

@jmarnold
Created November 3, 2010 18:33
Show Gist options
  • Save jmarnold/661484 to your computer and use it in GitHub Desktop.
Save jmarnold/661484 to your computer and use it in GitHub Desktop.
public class PartialActionExtensionsConvention : IRegistrationConvention
{
public void Process(Type type, Registry registry)
{
var extensionType = type.FindInterfaceThatCloses(typeof(IPartialActionExtension<>));
if(extensionType == null)
{
return;
}
registry
.For(extensionType)
.Add(type);
}
}
public class PartialActionExtensionsRegistry : Registry
{
public PartialActionExtensionsRegistry()
{
Scan(x =>
{
x.TheCallingAssembly();
x.Include(type => type.Closes(typeof(IPartialActionExtension<>)));
x.Exclude(type => type.IsInterface);
x.Exclude(type => type.IsAbstract);
x.With(new PartialActionExtensionsConvention());
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment