Posted by Anuraj on Saturday, October 31, 2015 Reading time :1 minute
ASP.NET5 comes with inbuilt dependency injection framework. This post is about using Autofac DI framework instead the in built DI framework. You can find more details about ASP.NET5 DI Framework in ASP.NET5 DependencyInjection respository. And you can find more details about Autofac in Autofac documentation
First you need to refererence the Autofac related assemblies in the project.json file
I am using the autofac getting started example interface and implementation.
And here is the implementation.
Then you need to regsiter types with autofac container in your startup file ConfigureServices() method. You also need to modify the signature of the method as well.
Now you have completed the configuration. You can use the IOutput in controller constructor like this.
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.