开发者

How do you set up StructureMap to use a Singleton with the Use<>.For<> syntax

开发者 https://www.devze.com 2023-02-27 05:15 出处:网络
I am using StructureMap with MVC3 I want to set it up to use a few of the objects as Singletons or to give them a Per Request life.All of the examples I see out there are for an older syntax of Struct

I am using StructureMap with MVC3 I want to set it up to use a few of the objects as Singletons or to give them a Per Request life. All of the examples I see out there are for an older syntax of StructureMa开发者_Go百科p as when I try out the example I see that it is depricated.

How do you do this using the newer Use<>.For<> Syntax?


Using version 2.6.1, this should work:

For<IFoo>().Singleton().Use<Bar>();
0

精彩评论

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