How is AutoFac better than Microsoft.Extensions.DependencyInjection? Autofac supports Property and Method injection (however I don't really understand where Property and Method injection might be useful).
I mean why should I use AutoFac when I can do the same thing by Microsoft.Extensions.DependencyInjection
It's a fair question; fundamentally the difference is in the additional features Autofac can offer you if you need them. For simple applications, the Microsoft DI may offer enough functionality, but I've found as my application grows there's some extra features I find myself wanting/needing.
The features that in my mind encouraged me to originally start using Aufofac are:
Meta<Lazy<IMyService>>
)There's plenty more, but those are some of my favourite features. Check the docs for all the goodness.
Also, there's no reason you can't start using the built-in DI and then add Autofac later when you realise you need it. The Autofac ASP.NET Core integration (https://autofaccn.readthedocs.io/en/latest/integration/aspnetcore.html) will just pick up all your existing registrations, and then you can add those extra features on top.
In the interest of full disclosure here, I will point out that I am one of the maintainers of Autofac.