I love “Infrastructure as Code because it provides you the luxury of making continuous improvements to your infrastructure by treating it as code. In reality, as developers we try to design and code to the best of our ability or come and refactor later. With IaC now we can do that for our infrastructure as well.
There are many tools which you can use to do that. This article is based on Azure and the default choice so far has been
ARM templates . There are some other third party providers in the game as well such as
This post is about dependency injection using Microsoft dependency injection framework. I use it a lot in my daily work and in personal projects.
When compared to its alternatives such as
Ninject one of the missing features (as of now) is to “discover” the dependencies and register in the framework. For example, in
Autofac it can scan through the assemblies and register your classes as their implemented interfaces or as self.
So in this post let’s try to help
Microsoft.DependencyInjection framework to find our dependencies and register them as we would like to do.
Consider you have…
Azure functions are great! but as in many frameworks there are times where you would like to extend or write your own custom logic to do what you are intending to do. It’s not about re-inventing the wheel of course, but how to use the underlying framework’s extension points so that you can build on top of that. So in this article let’s design and implement an Azure custom binding where you can use to validate JWT tokens issued by Azure Active Directory.
Imagine that you are implementing an HTTP triggered Azure function and, you would like to secure it…
It’s always a best practice to secure the APIs (or any other resource) once deployed into the cloud.
In here let’s build a set of APIs which will be deployed to Azure and, make them accessible to each other securely.
A popular API design pattern is backend for front end (BFF). The design pattern is there to define a service (BFF) which will communicate with one or more services to provide a response, rather than allowing the clients to call multiple services. This will be highly beneficial to the client because otherwise it might need to maintain different settings to…
As in any other application, testing Azure functions are utmost important.
Unit tests are targeted towards only a narrowed down aspect of the whole picture (as it should be anyways). Integration tests as per the name actually verifies how two or more components behave when integrated.
Azure durable functions lets you implement stateful functions. This is especially important if you would like to orchestrate a particular set of functions such as in a work flow fashion. Most of the time Azure functions are designed and implemented as a micro-service but these services need to work together to achieve a particular requirement.
Azure durable functions have three main function types,
This is the function which is in the front-line. This can be an HTTP API function, blob trigger, etc. This function’s responsibility is to get the input data and start a workflow.
In a previous article I explained how to load custom settings and to inject them as dependencies to your classes.
In here we are going to use custom JSON files to represent different configurations and how we can register them as dependencies.
The source code for this post can be found in here
There can be situations where your function app have many settings. This can be due to because of; it integrates with multiple other services or depending on the requirements or deployed environment you would like to customize the functions behavior.
When this happens your local settings file…
Azure functions are awesome. As in many projects you’ll have to interact with different components which will need specific settings to be included. Also you might have the need to customize your application settings so that they’ll have different values targeting the respective environment deployed. This article explains how you can inject your custom application settings as strongly typed dependencies to your classes.
The code for this can be found in GitHub. Also I have created a nuget package called “Hatan.Azure.Functions.DependencyInjection.Extensions” if you would like to use it in your projects.
The most popular way of using settings when developing…
There can be situations, where you need to set an
Enumas a generic constraint.
According to this SO answer finally it’s supported from C# 7.3,
Azure functions are great and, you can code a piece of functionality in a fairly decent amount of time with all the supported bindings and triggers.
In real world applications as developers we need to focus on not only the functionality but how to properly design and implement with better standard practices and design patterns. Well, one would say Azure functions has done more than enough (😆) by providing abstractions and implementations through triggers and bindings. But as developers it’s our responsibility to implement better quality code. …