Navigate / search

FluentValidation.Validators.UnitTestExtension version 1.4

I just managed to publish a new version of package FluentValidation.Validators.UnitTestExtension. This package allows you to write unit tests for Fluent Validators in a more effective way.

With version 1.4 following changes have been introduced:

  • new verifiers that check the configuration of EnumValidator, MaxLengthValidator, MinLenghtValidator, ExactLengthValidator, ExclusiveBetweenValidator and InclusiveBetweenValidator
  • support for .NETStandard 1.6 and .NETStandard 2.0

More information about the project is available on GitHub.

How to enable/disable Azure Function programmatically

Today I would like to write about something different. I am curious… Have you ever thought about enabling/disabling Azure Function by code? In such scenario, we would be able to decide about the state of the function directly from our application. I believe that you can find a lot of useful scenarios for such behaviour. I will provide two of them.

The first one. We have some resource that is not so fast and we would like to reduce the frequency of using it during the day. In such scenario, we can use Azure Storage Queue as a buffer for actions to compute. And turn on Azure Function only for a night and then in the morning turn it off again.

Another one is strictly connected with a question that I hear quite often during meetups or hackathons. Are we able to turn off function when we use all free capacity that is provided by Azure? People that are offering some small solution for public access would like to avoid the situation when they will need to pay for it. Read more

How you can improve code quality in your project?

Last Saturday during my lecture about code quality I was a bit shocked how many people didn’t know the most accessible tools that can improve code quality. You should remember that cost of quality improvements will be low only when we will think about those issues from the early beginning of the project. Every additional day when we are not monitoring and improving quality will increase the cost of potential quality issues fixes in future.

Of course, I would assume that each time we are trying to deliver good quality code but we are only humans. So even when we do not have enough budget for refactoring, I would like to advise to start monitoring the quality of code. Then we will be able to check present status of code quality and observe the general trend. It means that we will know where we are in our project. Read more

Sending emails from Azure Functions – SendGrid

I am trying to convince people that right now we should try to think about how we can build our application effectively. Instead of building everything from scratch we should look for possibilities of composition application from different elements. This means that you should write smaller amount of code and there is also smaller chance for making an error.

In case of Azure Functions natural choice for email service provider is SendGrid. Read more

Azure Function – Uploading photos to Azure Blob Storage

Today I would like to describe another production use case for Azure Functions. This time example is quite simple. I would like to use Azure Functions to upload photos to Azure Blob Storage. Of course, you can upload photos directly to Azure Blob Storage. However, with such solution, your components are tightly connected. This can block you in the future. To avoid that you should add some middle layer.

For this, you can use Azure Function. It will act like an API that will accept photos encoder in base64 and upload it to provided location. With this approach, you will be able to change storage component in the future very easy if needed. Read more