//internal for testing internal static void CheckOverridePolicy(ICustomAttributeProvider action, SmartContextFacade facade) { var changePolicy = action.GetCustomAttributes(true).FirstOrDefault(at => at is IOverrideValidationFailedPolicy).Cast <IOverrideValidationFailedPolicy>(); if (changePolicy != null) { facade.PolicyOverride = changePolicy; } }
//internal for testing internal SmartActionWorker CreateWorker(Controller ctrl, Func <dynamic> modelId, ICustomAttributeProvider action, IDependencyResolver solver) { if (ctrl == null) { throw new NotSupportedException("This attribute works only with Controller"); } var ipFactory = solver.GetService <IValidationFailedPolicyFactory>(); if (ipFactory == null) { ipFactory = new ValidationFailedPolicyActivator(solver); } var facade = new SmartContextFacade(ctrl, modelId, ValidationFailedPolicy ?? DefaultPolicy, ipFactory); CheckOverridePolicy(action, facade); var worker = new SmartActionWorker(facade); return(worker); }