Skip to content

Commit 2314e49

Browse files
committed
Refine server-side session store documentation with improved EF setup instructions and code snippet updates
1 parent 5018afb commit 2314e49

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/content/docs/bff/fundamentals/session/server-side-sessions.mdx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,24 @@ The default implementation stores the session in-memory. This is useful for test
3434

3535
## Using Entity Framework for the Server-Side Session Store
3636

37-
To use the EF session store, install the `Duende.BFF.EntityFramework` NuGet package and register it by calling `AddEntityFrameworkServerSideSessions`, like this:
37+
To use the EF session store, install the `Duende.BFF.EntityFramework` NuGet package:
38+
39+
```bash
40+
dotnet add package Duende.BFF.EntityFramework
41+
```
42+
43+
Next, you can register the session store by calling `AddEntityFrameworkServerSideSessions`, like this:
3844

3945
```csharp
4046
var cn = _configuration.GetConnectionString("db");
41-
47+
4248
builder.Services.AddBff()
4349
.AddEntityFrameworkServerSideSessions(options=>
4450
{
4551
options.UseSqlServer(cn);
4652
});
4753
```
54+
4855
The method of `AddEntityFrameworkServerSideSessions` registers the `SessionDbContext` along with a `UserSessionStore` as transient dependencies.
4956

5057
For developers looking to take advantage of DbContext pooling or have more fine-grained control over their DbContext creation registration and creation process, you can use the `AddEntityFrameworkServerSideSessionsServices` method instead. This method registers all the required services for server-side session except for the `SessionDbContext`, which will now be managed by the DbContext pooling mechanism.

0 commit comments

Comments
 (0)