-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.Net: Change Sqlite connector to accept connection string instead of DbConnection #10550
base: feature-vector-data-preb1
Are you sure you want to change the base?
Conversation
@@ -60,24 +43,9 @@ public static IServiceCollection AddSqliteVectorStore( | |||
string connectionString, | |||
SqliteVectorStoreOptions? options = default, | |||
string? serviceId = default) | |||
{ | |||
services.AddKeyedTransient<IVectorStore>( | |||
=> services.AddKeyedSingleton<IVectorStore>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the change from transient to singleton lifecycle here - this aligns with other connectors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my question, I would like to get a better understanding of the connection pooling first.
} | ||
|
||
#endregion | ||
|
||
#region private | ||
|
||
private async ValueTask<SqliteConnection> GetConnectionAsync(CancellationToken cancellationToken = default) | ||
{ | ||
var connection = new SqliteConnection(this._connectionString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does SqliteConnection
type implements it's own private pool of connections? So we don't actually open a new connection every time this method is being called?
Data Source=:memory:
cannot be used, since the databases only lives while the connection is open, and disappears immediately when closed.[Obsolete(error: true)]
, to have an informative error message for the user.Closes #10454
/cc @westey-m @dmytrostruk @adamsitnik