Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit f1e7c28

Browse files
committed
Aggiunta documentazione metodo AddDbContextUseSQLite
1 parent 66b5a30 commit f1e7c28

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Entity Framework Core DbContext Pool configuration for SQLite database
2+
3+
4+
## Configuration to add to the appsettings.json file
5+
6+
```json
7+
"ConnectionStrings": {
8+
"Default": "Data Source=Data/MyDatabase.db"
9+
},
10+
```
11+
12+
13+
## Registering services at Startup
14+
15+
```csharp
16+
public Startup(IConfiguration configuration)
17+
{
18+
Configuration = configuration;
19+
}
20+
21+
public IConfiguration Configuration { get; }
22+
23+
public void ConfigureServices(IServiceCollection services)
24+
{
25+
//OMISSIS
26+
27+
var connectionString = Configuration.GetSection("ConnectionStrings").GetValue<string>("Default");
28+
29+
//OMISSIS
30+
31+
services.AddDbContextUseSQLite<MyDbContext>(connectionString);
32+
}
33+
```
34+
35+
<b>Note:</b> You need to replace the <b>MyDbContext</b> value with the actual implementation of your DbContext

0 commit comments

Comments
 (0)