-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also decided to rename the method to AddSqliteConnection to be clearer as to what you're adding
- Loading branch information
1 parent
cf64c24
commit b5d214c
Showing
10 changed files
with
158 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# CommunityToolkit.Aspire.Hosting.Sqlite library | ||
|
||
Provides extension methods and resource definitions for the .NET Aspire AppHost to support creating and running SQLite databases. | ||
|
||
The integration also provides support for running [SQLite Web](https://github.com/coleifer/sqlite-web) to interact with the SQLite database. | ||
|
||
By default, the Sqlite resource will create a new SQLite database in a temporary location. You can also specify a path to an existing SQLite database file. | ||
|
||
## Getting Started | ||
|
||
### Install the package | ||
|
||
In your AppHost project, install the package using the following command: | ||
|
||
```dotnetcli | ||
dotnet add package CommunityToolkit.Aspire.Hosting.Sqlite | ||
``` | ||
|
||
### Example usage | ||
|
||
Then, in the _Program.cs_ file of `AppHost`, define an Sqlite resource, then call `AddSqlite`: | ||
|
||
```csharp | ||
var ollama = builder.AddSqlite("sqlite") | ||
.WithSqliteWeb(); | ||
``` | ||
|
||
## Additional Information | ||
|
||
https://learn.microsoft.com/dotnet/aspire/community-toolkit/sqlite | ||
|
||
## Feedback & contributing | ||
|
||
https://github.com/CommunityToolkit/Aspire |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
src/CommunityToolkit.Aspire.Microsoft.Data.Sqlite/PublicAPI.Unshipped.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
#nullable enable | ||
Microsoft.Extensions.Hosting.AspireSqliteExtensions | ||
Microsoft.Extensions.Hosting.SqliteClientSettings | ||
Microsoft.Extensions.Hosting.SqliteClientSettings.ConnectionString.get -> string? | ||
Microsoft.Extensions.Hosting.SqliteClientSettings.ConnectionString.set -> void | ||
Microsoft.Extensions.Hosting.SqliteClientSettings.DisableHealthChecks.get -> bool | ||
Microsoft.Extensions.Hosting.SqliteClientSettings.DisableHealthChecks.set -> void | ||
Microsoft.Extensions.Hosting.SqliteClientSettings.SqliteClientSettings() -> void | ||
static Microsoft.Extensions.Hosting.AspireSqliteExtensions.AddKeyedSqliteClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder! builder, string! name, System.Action<Microsoft.Extensions.Hosting.SqliteClientSettings!>? configureSettings = null) -> void | ||
static Microsoft.Extensions.Hosting.AspireSqliteExtensions.AddSqliteClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder! builder, string! name, System.Action<Microsoft.Extensions.Hosting.SqliteClientSettings!>? configureSettings = null) -> void | ||
Microsoft.Extensions.Hosting.SqliteConnectionSettings | ||
Microsoft.Extensions.Hosting.SqliteConnectionSettings.ConnectionString.get -> string? | ||
Microsoft.Extensions.Hosting.SqliteConnectionSettings.ConnectionString.set -> void | ||
Microsoft.Extensions.Hosting.SqliteConnectionSettings.DisableHealthChecks.get -> bool | ||
Microsoft.Extensions.Hosting.SqliteConnectionSettings.DisableHealthChecks.set -> void | ||
Microsoft.Extensions.Hosting.SqliteConnectionSettings.SqliteConnectionSettings() -> void | ||
static Microsoft.Extensions.Hosting.AspireSqliteExtensions.AddKeyedSqliteConnection(this Microsoft.Extensions.Hosting.IHostApplicationBuilder! builder, string! name, System.Action<Microsoft.Extensions.Hosting.SqliteConnectionSettings!>? configureSettings = null) -> void | ||
static Microsoft.Extensions.Hosting.AspireSqliteExtensions.AddSqliteConnection(this Microsoft.Extensions.Hosting.IHostApplicationBuilder! builder, string! name, System.Action<Microsoft.Extensions.Hosting.SqliteConnectionSettings!>? configureSettings = null) -> void |
43 changes: 43 additions & 0 deletions
43
src/CommunityToolkit.Aspire.Microsoft.Data.Sqlite/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# CommunityToolkit.Aspire.Microsoft.Data.Sqlite library | ||
|
||
Register a `SqliteConnection` in the DI container to interact with a SQLite database using ADO.NET. | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
- A SQLite database | ||
|
||
### Install the package | ||
|
||
Install the .NET Aspire EF Core Sqlite library using the following command: | ||
|
||
```dotnetcli | ||
dotnet add package CommunityToolkit.Aspire.Microsoft.Data.Sqlite | ||
``` | ||
|
||
### Example usage | ||
|
||
In the _Program.cs_ file of your project, call the `AddSqliteConnection` extension method to register the `SqliteConnection` implementation in the DI container. This method takes the connection name as a parameter: | ||
|
||
```csharp | ||
builder.AddSqliteConnection("sqlite"); | ||
``` | ||
|
||
Then, in your service, inject `SqliteConnection` and use it to interact with the database: | ||
|
||
```csharp | ||
public class MyService(SqliteConnection context) | ||
{ | ||
// ... | ||
} | ||
``` | ||
|
||
## Additional documentation | ||
|
||
- https://learn.microsoft.com/dotnet/aspire/community-toolkit/sqlite | ||
- https://learn.microsoft.com/dotnet/standard/data/sqlite | ||
|
||
## Feedback & contributing | ||
|
||
https://github.com/CommunityToolkit/Aspire |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite library | ||
|
||
Register a `DbContext` in the DI container to interact with a SQLite database using Entity Framework Core. | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
- A `DbContext` | ||
- A SQLite database | ||
|
||
### Install the package | ||
|
||
Install the .NET Aspire EF Core Sqlite library using the following command: | ||
|
||
```dotnetcli | ||
dotnet add package CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite | ||
``` | ||
|
||
### Example usage | ||
|
||
In the _Program.cs_ file of your project, call the `AddSqliteDbContext<TDbContext>` extension method to register the `TDbContext` implementation in the DI container. This method takes the connection name as a parameter: | ||
|
||
```csharp | ||
builder.AddSqliteDbContext<BloggingContext>("sqlite"); | ||
``` | ||
|
||
Then, in your service, inject `TDbContext` and use it to interact with the database: | ||
|
||
```csharp | ||
public class MyService(BloggingContext context) | ||
{ | ||
// ... | ||
} | ||
``` | ||
|
||
## Additional documentation | ||
|
||
- https://learn.microsoft.com/dotnet/aspire/community-toolkit/sqlite-entity-framework-integration | ||
- https://learn.microsoft.com/ef/core/providers/sqlite/ | ||
|
||
## Feedback & contributing | ||
|
||
https://github.com/CommunityToolkit/Aspire |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters