We will be building a fully functional “microservice” that will be able to add, remove, and return a list of products. For this example we will mo

Building a serverless “shopping Cart” microservice using Azure functions and Durable entities with c#

submited by
Style Pass
2020-09-18 14:31:45

We will be building a fully functional “microservice” that will be able to add, remove, and return a list of products. For this example we will model the way this microservice will be consumed will be done via REST. Get your coding hat on, we are about to start.

Before we begin you should have a new function project setup and the durable functions set-up. If you are not very sure about how to achieve this, here is a link to the official documentation.

Pro tip: in some IDEs (I use Rider) you have the option on the project setup to chose durable functions, so you don’t need to install the required NuGet packages by hand.

So, since you found this article via searching or by clicking somewhere on social media, you should already know what durable entities are, or at least have an idea about them. But, just to be sure that we are all on the same page we will be doing a small introduction on durable entities, and why, when, and where we might be able to benefit from them.

“Durable entities” or “entity functions”, how they are called nowadays, are mostly inspired by the virtual actors pattern from the Orleans project, which in term are quite inspired by Akka/Akka.net. Going into this topic is well outside of our scope, but you will find an introduction in them in the links provided, also I highly recommend looking a bit into them, because understanding the strengths and weaknesses of the actor pattern will help you when trying to determine if the durable entities might be a good match for you or should you use a more traditional SQL or NoSql storage.

Leave a Comment