User Review( votes)
Microsoft Azure pros share their insights on creating dependency injections for Azure Functions, Kubernetes Service cluster manageability, security development lifecycles and converting Classic Resources to ARM.
Dependency injection with Azure Functions
Nishanth Prabhakaran, writing on the Serverless360 blog, explored how to manage dependency injections with Azure Functions. Dependency injections are patterns used to setup “loosely coupled modules of code,” for better performance and scalability, together with inversion of control between different classes and dependencies. Traditionally, modules and services have been tightly paired, resulting in higher memory consumption and reduced efficiency, whereas dependency injection a single object can be accessed by multiple modules.
Prabhakaran emphasized the benefits of dependency injection such as rapid reusability, more readable code and more variable service lifetimes. He imagined a common booking scenario with Azure Functions, wherein a dependency injection connects the Function with a Validator Service. He cautioned:
Dependency Injection in Azure Functions cannot be implemented from the Azure Portal. Dealing with objects, dependency needs to be implemented within the class whereas, in the Azure portal, there will be a static Function without a class. So, there will be a need for a Visual Studio tool for Dependency Injection implementation.
From there, he shared code to accomplish the task and instructions on publishing the Function and managing service lifetimes.