开发者

Which Structuremap Lifecycle is best practice? (v2.5.4)

which of the following syntax is considered best practice?

For<IMyInterface>().LifecycleIs(new HybridLifecycle()).Use<MyImplementation>();

For<IMyInterface>().LifecycleIs(Lifecycles.GetLifecycle(InstanceScope.Hybrid)).Use<MyImplementation>();

if the first one is corre开发者_如何学Goct, can I create one object HybridLifecycle, and use it for multiple For<...> statements, or is it necessary for each For<> to create a new HybridLifecycle?


Using the configuration helpers is probably the best practice.

    For<IMyInterface>().HybridHttpOrThreadLocalScoped().Use<MyImplementation>()
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜