Eliminating static properties - What patterns do I have at my disposal?
Posted
by
Jamie Dixon
on Stack Overflow
See other posts from Stack Overflow
or by Jamie Dixon
Published on 2012-04-09T10:57:31Z
Indexed on
2012/04/09
11:28 UTC
Read the original article
Hit count: 257
I currently have a type that I inject into my controllers that's used for getting and setting session data.
I use this so that I can obtain relevant session information as _sessionData.Username
rather than using Session["username"]
.
I'd like to use this session information across all of my views and would previously have done this by making the SessionData members static instead of injecting the SessionData class into my controller.
I want to avoid using static members as well as having to pass the object to the view in each controller.
What patterns best suit this type of scenario? What do you do to solve this same problem?
© Stack Overflow or respective owner