Wrapped ASP.NET Core session state
The AddWrappedAspNetCoreSession implementation wraps the session provided on ASP.NET Core so that it can be used with the adapters. The session uses the same backing store as Microsoft.AspNetCore.Http.ISession
but provides strongly-typed access to its members.
Configuration for ASP.NET Core looks similar to the following:
builder.Services.AddSystemWebAdapters()
.AddJsonSessionSerializer(options =>
{
// Serialization/deserialization requires each session key to be registered to a type
options.RegisterKey<int>("test-value");
options.RegisterKey<SessionDemoModel>("SampleSessionItem");
})
.AddWrappedAspNetCoreSession();
The framework app doesn't need any changes to enable this behavior.
For more information, see the AddWrappedAspNetCoreSession sample app
Tee yhteistyötä kanssamme GitHubissa
Tämän sisällön lähde on GitHubissa, jossa voit myös luoda ja tarkastella ongelmia ja pull-pyyntöjä. Katso lisätietoja osallistujan oppaasta.
ASP.NET Core