开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜