Chapter 5. Creating a Data Service
If you’ve been doing any reading lately about cloud-native services and applications, then you’re probably getting sick of hearing that these services all need to be stateless.
Stateless in this case doesn’t mean that state can’t exist anywhere; it just means that it cannot exist in your application’s memory. A truly cloud-native service does not maintain state between requests.
To build stateless services, we really just need to kick the state responsibility a little further down the road. In this chapter, we’ll talk about how to build a microservice that depends on an external data source. Our code in this chapter will work with Entity Framework (EF) Core, and we’ll upgrade the team and location services we’ve been working with to true data persistence.
Choosing a Data Store
There are many risks associated with embracing a 1.0-level technology. The ecosystem is generally immature, so support for your favorite things may be lacking or missing entirely. Tooling and integration and overall developer experience are often high-friction. Despite the long and storied history of .NET, .NET Core (and especially the associated tooling) should still be treated like a brand new 1.0 product.
One of things we might run into when trying to pick a data store that is compatible with EF Core is a lack of available providers. While this list will likely have grown by the time you read this, at the time this chapter was written, the following providers were available ...
Get Building Microservices with ASP.NET Core now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.