Chapter 5: Persistence in Grains
In the last chapter, we learned about Orleans grains and silos, which host grains. We also learned about one of the most prominent hosting patterns, co-hosting Orleans applications with an ASP.NET Core application. The grains we built in the last chapter do not have any state associated with them. In the real world, most applications will deal with data. This data (or state as we call it) should be stored in some persistent storage and be presented to the client application when needed.
In this chapter, we will learn how we manage state in Orleans, and in due course, we will cover the following topics:
- Understanding grain state persistence
- Creating a custom state provider
- Grains with multiple states
- Grains directly interacting with a database