Here you can do the work with the new IRegistrationConvention API:
public class SingletonConvention : IRegistrationConvention
{
#region IRegistrationConvention Members
public void Process(Type type, Registry registry)
{
registry.For(type).Singleton();
}
#endregion
}
It can be used as follows:
container.Configure(registry =>
{
registry.Scan(x =>
{
x.AssemblyContainingType<Foo>();
x.AddAllTypesOf<IFoo>();
x.Convention<SingletonConvention>();
});
});
source
share