.Net: New Feature: Support synchronous construction for SqliteMemoryStore
SqliteMemoryStore implements IMemoryStore, where all its method are async, so I understand why its implemented this way even though Microsoft.Data.Sqlite does not recommend using asynchronous I/O.
SQLite doesn't support asynchronous I/O. Async ADO.NET methods will execute synchronously in Microsoft.Data.Sqlite. Avoid calling them.
However, its constructor is private and it can only be instantiaded asynchronously via its static ConnectAsync method, which makes it challenging to configure as a service in DI container or in an object pool. Moreover, given that ConnectAsync is not dictated by IMemoryStore, it would be useful to also include a Connect method, or some other means of constructing it synchronously.
Hi @westey-m is this something we want to support with the new memory connector abstractions?
When implementing the SQLite implementation of the new memory connector abstractions we should definitely reconsider this. I don't think we necessarily need the connect method. There is a challenge around when to create tables, but it'll really depend on how we represent collections. That will need to be re-thinked quite a bit in the new system, since a goal is to support consuming data from existing stores, and not just ones created by our system.
The new Sqlite VetorStore implementation allows synchronous construction. Recommendation is to switch to using it instead of the MemoryStore implementation.