1

If you have the StructureMap.MVC5 nuget package installed, and update the structuremap nuget package, the ControllerConvention class will require you to implement the ScanTypes method (from an updated IRegistrationConvention interface). This is the method signature:

public void ScanTypes(TypeSet types, Registry registry)

So my question is,

  1. will there be an updated release to the StructureMap.MVC5 nuget package?
  2. how should I implement the method?

Thanks.

Pouya Barrach-Yousefi
  • 1,207
  • 1
  • 13
  • 27
  • 2
    The first question isn't a good fit to StackOverflow -- if the project has a bug tracker, you should be looking for any tickets on the subject there. – Charles Duffy Jan 20 '16 at 15:11

2 Answers2

8

Based on Charles Duffy's response, I went searching and found an answer: https://github.com/webadvanced/Structuremap.MVC5/issues/15

public void ScanTypes(TypeSet types, Registry registry)
{
    types.AllTypes().ForEach(type =>
    {
        if (type.CanBeCastTo<Controller>() && !type.IsAbstract)
        {
            registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());
        }
    });
}

The poster (and I) is "not sure if this is the best way to go".

Pouya Barrach-Yousefi
  • 1,207
  • 1
  • 13
  • 27
0

It doesn't appear as if the Structuremap.MVC5 package will be updated to support Structuremap 4.x directly.

However a relatively minor change will get it working.

@mnwsmitgave a good implementation explanation here - https://stackoverflow.com/a/35913874/1019768

Community
  • 1
  • 1
richardwhatever
  • 4,564
  • 5
  • 23
  • 26