I suggest replacing it with something like so:
using StructureMap;
using StructureMap.Graph.Scanning;
namespace Airport.UserInterface.DependencyResolution
{
using System;
using System.Web.Mvc;
using StructureMap.Graph;
using StructureMap.Pipeline;
using StructureMap.TypeRules;
public class ControllerConvention : IRegistrationConvention
{
public void ScanTypes(TypeSet types, Registry registry)
{
foreach (Type type in types.AllTypes())
{
if (type.CanBeCastTo<Controller>() && !type.IsAbstract)
{
registry.For(type).LifecycleIs(new UniquePerRequestLifecycle());
}
}
}
}
}
Obviously, this will need to be changed up some at your app as your app will not be named "Airport" right? I didn't know that using directives could be nested inside of a namespace, but it seems that they may be.
No comments:
Post a Comment