Slide 01
Let's head on over to the Worker.cs file so that we can begin using Dependency Injection.
We'll create a constructor method so that the Dependency Injection Service can inject any dependent objects we need in our Worker Class.
We'll inject Iconfiguration and bring in the namespace. While we're here we might as well create a class member for the property.
We'll also inject Ilogger which we'll also need to bring in the namespace for that. We'll have Visual Studio create the member for us.
Let's remove the Console Write Line and replace it with a Logging Statement to make sure the injection service is working as expected.
Let's run it and see if it works!
Hot Dog!!! Gotta love it when things just work out-of-box!!!
In the next video we'll see how we can use configuration settings from an appsetting.json file.
I'll see you there!
Ещё видео!