1

The following code not working on StructureMap 3:

x.For<Environment>()
    .LifecycleIs(StructureMap.Pipeline.Lifecycles.GetLifecycle(InstanceScope.HttpContext))
    .Use(c => Environment.GetEnvironment("APP"));
x.SelectConstructor(() => new HelpController());

InstanceScope.HttpContext not working StructureMap 3

SelectConstructor() not working on StructureMap 3

Tony Bao
  • 922
  • 2
  • 12
  • 23

1 Answers1

4

The "new" syntax for Lifecycles, which is also available in Structuremap 2, is the following

x.For<Environment>()
    .LifecycleIs<HttpContextLifecycle>()
    .Use(c => Environment.GetEnvironment("APP"));

EDIT:

The replacement for SelectConstructor is now under PolicyExpression

x.Policies.ConstructorSelector(...);

There's a change to the way ConstructorSelector works. Best idea is to have a look at the Test source, to see how it it used.

Xenolightning
  • 4,140
  • 1
  • 26
  • 34