I am using StructureMap on an ASP.NET MVC project. I have an object that I want to use throughout the session. Should I use StructureMap or Session:[“MyObject”] to manage the concrete instance? Thanks in advance.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This will depend on your scenario. If this instance is tied to a particular user and should not be shared between other users you should use
Session. For example useSessionto store products that the user added to his cart in an e-commerce application.If it is for injecting dependencies such as repositories into your controllers and managing controllers
StructureMapis fine.