semantic-kernel
semantic-kernel copied to clipboard
.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.