From the course: Azure Functions for Developers

Unlock the full course today

Join today to access over 25,100 courses taught by industry experts.

Refactoring the PDF creation logic to the PdfCreatorService class

Refactoring the PDF creation logic to the PdfCreatorService class - Azure Tutorial

From the course: Azure Functions for Developers

Refactoring the PDF creation logic to the PdfCreatorService class

- [Instructor] One of the cool things about using the isolated worker model is that you can use your existing ASP.net core knowledge to build Azure functions. Specifically, you can raise their services in the DI container and then inject those objects in your class constructors. That's actually what I'm going to show you in this video. The thing about the current implementation is that I'm repeating the PDF creation logic here in the watcher function and also in the PDF Creator function. So let's refactor the code and create a new PDF Creator service class. Let's do it. PDF Creator Service. And let's use the file scope namespace syntax and let's cut this out and paste it here. Let's use public for both the class and the method, and be aware that it's not necessary to create an interface since I only have one implementation of this logic. I think interfaces are great when you have more than one implementation, but this is not the case. Okay, so now we can go ahead and open the program…

Contents