orleans icon indicating copy to clipboard operation
orleans copied to clipboard

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

Open DoubleDBE opened this issue 2 years ago • 3 comments

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)

DoubleDBE avatar Nov 24 '22 20:11 DoubleDBE

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.

jonathan avatar Nov 25 '22 16:11 jonathan

@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 :)

sec avatar Sep 21 '23 14:09 sec

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

m3nax avatar Jan 18 '24 15:01 m3nax