开发者

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

开发者 https://www.devze.com 2022-12-19 07:49 出处:网络
which of the following syntax is considered best practice? For<IMyInterface>().LifecycleIs(new HybridLifecycle()).Use<MyImplementation>();

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

精彩评论

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

关注公众号