.netorleansdata-persistence

Data Persistence in Microsoft Orleans


I'm new in Microsoft Orleans and when reading the documentation I found this :

... Grain persistence uses an extensible plugin model so that storage providers for any database can be used. This persistence model is designed for simplicity and is not intended to cover all data access patterns. Grains can also access databases directly, without using the grain persistence model. here

But in the rest of the documentation, is only described means to use Storage Providers for grain persistence. But with these providers I'm still wondering how to perform complex requests as in relational databases (with JOIN, GROUP BY, ORDER BY etc..).

So my concern is the following :

What could be the advantages and the disadvantages of using direct access to a relational database for Grain persistence?


Solution

  • Orleans is not opinionated on how you store your data: do what's right for your application. In response to your question, here are some advantages and disadvantages of taking the manual route and interfacing directly with a database instead of using the out-of-the-box persistence model.

    Advantages:

    Disadvantages:

    Those advantages can be compelling, depending on your needs.

    You can also take a hybrid approach and write a custom storage provider which gives you some control over how your data is stored, and because you control that, you can then also access the database directly to perform queries.