-
Notifications
You must be signed in to change notification settings - Fork 2
How to create conventions for Service Locator
marektihkan edited this page Sep 13, 2010
·
1 revision
- Create new class which inherits
Arc.Infrastructure.Configuration.Conventions.ServiceLocatorConvention
(base class) /Arc.Infrastructure.Configuration.Conventions.IConvention<IServiceLocator>
- Define mappings with AutoRegistration
- Add builder method for convention (optional)
public class ControllersConvention : ServiceLocatorConvention
{
private readonly string[] _assemblies;
private ControllersConvention(string[] assemblies)
{
_assemblies = assemblies;
}
public static IConvention<IServiceLocator> ApplyTo(params string[] assemblies)
{
return new ControllersConvention(assemblies);
}
protected override void DefineRules()
{
For(_assemblies)
.Pick(x => x.Name.EndsWith("Controller"))
.BindToSelf();
}
}