In my registry I have
Scan(scanner =>
{
scanner.AssemblyContainingType<EmailValidation>();
scanner.ConnectImplementationsToTypesClosing(typeof(IValidation<>));
});
What am I supposed to do to define these all as Singletons?
Also as an aside to this question, is there any reason to not define everything that is stateless as a singleton object that's registered in StructureMap?
Kevin's answer is correct for versions 2.5.4 and older. In the current StructureMap trunk (and when 2.5.5+ is released), you can now do:
Scan(scanner =>
{
scanner.AssemblyContainingType<EmailValidation>();
scanner.ConnectImplementationsToTypesClosing(typeof(IValidation<>))
.OnAddedPluginTypes(t => t.Singleton());
});