Created
October 31, 2019 12:03
-
-
Save trnktms/9b6bba7563f44db0053a74001abf9e7d to your computer and use it in GitHub Desktop.
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
public static class SessionExtensions | |
{ | |
public static void AddSessionWithStartSession(this IServiceCollection services) | |
{ | |
services.AddSingleton<ISessionStore, DistributedSessionStoreWithStart>(); | |
services.AddDistributedMemoryCache(); | |
services.AddSession(options => | |
{ | |
options.Cookie.IsEssential = true; | |
}); | |
services.AddSingleton<IStartSession>(s => | |
{ | |
var startSession = new StartSession(); | |
// Add here other actions if more funcionality is needed for session start | |
startSession.AddToStartSession(s.GetRequiredService<IUrlRefererService>().SetSessionStartRefererUrl); | |
return startSession; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment