semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

.Net: New Feature: Support synchronous construction for SqliteMemoryStore

Open f2bo opened this issue 6 months ago • 2 comments

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.

f2bo avatar Aug 03 '24 20:08 f2bo