Should I use StructureMap or Session to manage a concrete instance?
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.
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 use Session
to 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 StructureMap
is fine.
精彩评论