tags:

views:

357

answers:

1

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 correct, 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?

+1  A: 

Using the configuration helpers is probably the best practice.

    For<IMyInterface>().HybridHttpOrThreadLocalScoped().Use<MyImplementation>()
KevM
not alle scopes are provided as helpers, only HYbridHttpOrThreadLocalScoped and HttpContextScoped ..
rekna
I believe they are which ones are you not finding? Singleton(), AlwaysUnique() are also available. I think Jeremy may be trying to move people to the Hybrid approaches to HTTP and Thread scoping of types.
KevM