-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
${aspnet-session} - added ValueType to handle integer session values #570
Conversation
Instead of having a generic property-type, Then just have Int32 / string as enum-values. But yes a ValueType-property sounds fine. |
Strange that Microsoft have not added some kind of byte-order-mark to signal whether byte-array is an integer or string. |
Or just an int which would be utf8 compatible. Yes, less efficient. This int "encoding" is just unsafe stuff |
Yes also think it would be nicer that the SetInt32-extension-method, just converted integer into utf8-byte-array without doing string-allocation first. Not sure people using session-state-objects care much about 4 or 10 bytes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great
/// <summary> | ||
/// The type of a value | ||
/// </summary> | ||
public enum SessionValueType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like the name
@@ -62,7 +62,7 @@ internal static HttpResponse TryGetResponse(this HttpContext context) | |||
} | |||
#endif | |||
|
|||
#if ASP_NET_CORE | |||
#if ASP_NET_CORE1 || ASP_NET_CORE2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea since ASP_NET_CORE3 includes entire framework
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
see https://stackoverflow.com/questions/62054400/can-the-nlog-aspnet-sessionvariable-intid-renderer-extract-display-integers-f/62054553#62054553
I think the only solution here is to add a type option to the renderer. What do you think @snakefoot ?
(If it's 4 bytes long, we only know it could be an int)
PS: these are the extensions in ASP.NET Core: