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

Registry style approach to convention configuration DSL

171 Views
Copy Code Show/Hide Line Numbers
public class MyConventionRegistry : ConventionRegistry
{
    public MyConventionRegistry()
    {
        Part<PartConvention>()
            .ForTypesMatching(x => x.Name.StartsWith("Foo"))
            .MakeNonShared()
            .Imports(i =>
            {
                i.Import<ImportConvention>().As<IImportConvention>();
                i.Import<ImportConvention>().As<IFormattable>();
                i.Import<ImportConvention>().As<IAppDomainSetup>();
            });
 
        Part<PartConvention>()
            .ForTypesMatching(x => x.Name.StartsWith("Bar"))
            .MakeNonShared();
    }
}
by TheCodeJunkie
  February 01, 2010 @ 2:08am

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