O'Reilly logo

Building Microservices with ASP.NET Core by Kevin Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required