protected override BuildPlan GetBuildPlan() { var paramInject = InjectionPoints.OfType <MethodParameterInjectionPoint>().ToArray(); var constructPlan = MakeConstructPlan(paramInject.Where(x => x.IsConstructor)); var methodInject = InjectMethods(paramInject.Where(x => !x.IsConstructor)).ToArray(); var otherInjects = InjectionPoints.Except(paramInject).Cast <IWeldInjetionPoint>(); return(context => { var instance = constructPlan(context); context.Push(instance); foreach (var i in otherInjects) { i.Inject(instance, context); } foreach (var i in methodInject) { i(instance, context); } foreach (var post in PostConstructs) { post.Invoke(instance, new object[0]); } return instance; }); }
protected override BuildPlan GetBuildPlan() { var paramInjects = InjectionPoints .OfType <MethodParameterInjectionPoint>() .Where(x => x.Member == _method) .OrderBy(x => x.Position).ToArray(); return(context => { var containingObject = Manager.GetReference(DeclaringComponent, context); var paramVals = paramInjects.Select(p => p.GetValue(context)).ToArray(); return _method.Invoke(containingObject, paramVals); }); }
public AdviceAttribute(InjectionPoints points, InjectionTargets targets) { Points = points; Targets = targets; }