dotnet / orleans

Cloud Native application framework for .NET
https://docs.microsoft.com/dotnet/orleans
MIT License
9.94k stars 2.02k forks source link

ADO.NET - Using Microsoft.Data.Sqlite for persistence? #8187

Open DoubleDBE opened 1 year ago

DoubleDBE commented 1 year ago

Can this framework be used with Microsoft.Data.Sqlite for persistence?

When I install Microsoft.Data.Sqlite and configure it for usage, I get the following exception when I run the app:

System.Collections.Generic.KeyNotFoundException: 'The given key 'Microsoft.Data.Sqlite' was not present in the dictionary.'

But according to this line of code it should be possible to use it, right?

Config is setup like this:

.UseAdoNetClustering(e => { e.ConnectionString = "Data Source=database.db"; e.Invariant = "Microsoft.Data.Sqlite"; }) .AddAdoNetGrainStorage("test", e => { e.ConnectionString = "Data Source=database.db"; e.Invariant = "Microsoft.Data.Sqlite"; })

The latest version of Orleans is being used (7.0.0)

jonathan commented 1 year ago

It looks like sqlite persistence is missing from here: https://github.com/dotnet/orleans/tree/main/src/AdoNet/Orleans.Persistence.AdoNet

I'm sure the team would appreciate a PR with adding support for Sqlite.

sec commented 9 months ago

@DoubleDBE Just to add my two cents, as I also hit this recently. Using "pure" SQLite doesn't make sense, as all of your silos would need to have access to database file, unless you have only one silo :)

What I've been playing around lately is using rqlite as grain storage, feel free to take/use the code if you like it :)

m3nax commented 5 months ago

@sec Can be used to persist data in developer environment or in single node installation for example in staging environment for testing purpose