Created
August 13, 2012 01:23
-
-
Save shanefulmer/3336201 to your computer and use it in GitHub Desktop.
Handler 5
This file contains 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 CoreRegistry : Registry | |
{ | |
public CoreRegistry() | |
{ | |
Scan(cfg => | |
{ | |
cfg.TheCallingAssembly(); | |
cfg.WithDefaultConventions(); | |
cfg.IncludeNamespaceContainingType<Foo>(); | |
cfg.ConnectImplementationsToTypesClosing(typeof(IRenderer<>)); | |
}); | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
ObjectFactory.Initialize(init => init.AddRegistry<CoreRegistry>()); | |
var fooRenderers = ObjectFactory.GetAllInstances<IRenderer<Foo>>(); | |
var textHandler = fooRenderers.SingleOrDefault(x => x.GetType().Name.Contains("Text")); | |
textHandler.Render(new Foo()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment