Is it possible to get container type in AutoFac
For example, I have registered class C1 with one parameter in constructor of type System.Type . I have another class (C2) with injected parameter of type C1. And I want receive typeof(C2) automatically in C1 constructor. Is it possible in some way? Example code: public class C1 { public C1(Type type) {} // ... } public class C2 { public C2(C1 c1) {} // ... } // Registration containerBuilder.Register(???); containerBuilder.Register<C2>(); Nicholas Blumhardt This should do it: builder.RegisterType<C1>(); builder.RegisterType<C2>(); builder.RegisterModule(new ExposeRequestorTypeModule()); Where: