What does AsSelf do in autofac? [duplicate]
Typically you would want to inject interfaces, rather than implementations into your classes. But let’s assume you have: interface IFooService { } class FooService { } Registering builder.RegisterType<FooService>() allows you to inject FooService, but you can’t inject IFooService, even if FooService implements it. This is equivalent to builder.RegisterType<FooService>().AsSelf(). Registering builder.RegisterType<FooService>().As<IFooService>() allows you to inject IFooService, … Read more