Autofac: Batch registration of open-generic types

In a similar style to Jim's answer but taking advantage of AsClosedTypesOf:

Assembly[] assemblies = GetYourAssemblies();

builder.RegisterAssemblyTypes(assemblies)
    .AsClosedTypesOf(typeof(IHandler<>));

You probably want something like this, although I'm not sure how IsAssignable() behaves with open generics.

Assembly[] assemblies = GetYourAssemblies();

builder.RegisterAssemblyTypes(assemblies)
    .Where(t => t.IsAssignableFrom(typeof(IHandler<>)))
    .AsSelf()
    .AsImplementedInterfaces();