CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

Default contract name and type identity spike

158 Views
Copy Code Show/Hide Line Numbers
public class TestRegistry
{
    public TestRegistry()
    {
        Defaults(x => {
            x.Type<Foo>().Contract("Andreas").Identity<IWidget>();
            x.Type<Bar>().Contract("Piotr").Identity<IUnity>();
        });
 
        Part()
            .ForType<InjectedHost>()
            .ExportType()
            .ImportConstructor()
            .MakeShared();
 
        Part()
            .ForTypesImplementing<IWidget>()
            .ExportTypeAs<IWidget>()
            .MakeShared();
    }
}
by TheCodeJunkie
  May 25, 2010 @ 5:07am

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate