example of convention extension
kernel.Bind(x =>
{
x.FromThisAssembly()
.SelectAllClasses()
.WithAttribute<SomeAttribute>()
.BindBase();
});
And each type which I get should be provide complex initiation with this method
public static IPage GetInstance(Type type)
{
MethodInfo method = typeof(PageService).GetMethod("Create");
IPage page = (IPage)method.MakeGenericMethod(type).Invoke(null, new object[] { null });
return page;
}
Create a
IBindingGenerator
:and use it as follows: