Created
November 3, 2010 18:33
-
-
Save jmarnold/661484 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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