“Get out form smog” – dependency injection

Get out from smog – part V

Today post will be about depencendy injection.And run all the written functions as a whole. Uses for this Autofac and Autofac.Mvc – to inject depencencies on the contollers.

I created class to register depencencies.

We register the interface to a particular class and the ability to inject into the contoller.

Now inject interface into the contoller constructor.

Thanks to this magician we can now call our functions like this:

Thanks to this, we have received the nears measuring station within a radius of 100 km from the user’s location.


In the next step I will try to find the cleanest air among from this stactions.

Link to the project: HERE

Leave a Reply

Your email address will not be published. Required fields are marked *