# IT:AD:StructureMap:HowTo:Register Instances against Open Contracts # * [[../|(UP)]] {{indexmenu>.#2|nsort tsort}} Got to admit that a feature like this does make you question why I use [[IT/AD/Unity/]] so often... ## Process ## //Notice how it's an open type: Type closingType = typeof(IUnitTestDbContextSeeder<>); ObjectFactory .Initialize(config => config.Scan(scanner => { scanner.Assembly(GetType().Assembly);//this assembly only... scanner.IncludeNamespaceContainingType();//this ns only... scanner //register types implementing open contract as singletons: .ConnectImplementationsToTypesClosing(closingType) //<-- NEAT! .OnAddedPluginTypes(expression => expression.Singleton()); //as singletons } )); ## Resources ##