public void Process(Type type, StructureMap.Configuration.DSL.Registry registry) { if (type.CanBeCastTo(typeof(Controller)) && !type.IsAbstract) { registry.For(type).LifecycleIs(new UniquePerRequestLifecycle()); } }
/// <summary> /// Directs StructureMap to always inject dependencies into any and all public Setter properties /// of the type TPluginType. /// </summary> /// <typeparam name="TPluginType"></typeparam> /// <returns></returns> public CreatePluginFamilyExpression <TPluginType> FillAllPropertiesOfType <TPluginType>() { Func <PropertyInfo, bool> predicate = prop => prop.PropertyType == typeof(TPluginType); _parent.alter = graph => graph.Policies.SetterRules.Add(predicate); return(_parent.For <TPluginType>()); }