- use tryGetMultitonScopeArgument method to throw exception earlier

ImplementExpressionTrees v4.0.0-beta7
Simon G 3 years ago
parent 8203d2a206
commit 88c04c2314
  1. 7
      LightweightIocContainer/IocContainer.cs

@ -168,8 +168,11 @@ public class IocContainer : IIocContainer, IIocResolver
arguments = UpdateArgumentsWithRegistrationParameters(registrationWithParameters, arguments); arguments = UpdateArgumentsWithRegistrationParameters(registrationWithParameters, arguments);
List<object?>? resolveArguments = arguments?.ToList(); List<object?>? resolveArguments = arguments?.ToList();
if (resolveArguments != null && registration is IMultitonRegistration) if (resolveArguments != null && registration is IMultitonRegistration multitonReg) //remove scope argument for multitions
resolveArguments.RemoveAt(0); //remove scope argument for multitions {
object multitonScopeArgument = TryGetMultitonScopeArgument(multitonReg, resolveArguments);
resolveArguments.Remove(multitonScopeArgument);
}
Type registeredType = GetType<T>(registration); Type registeredType = GetType<T>(registration);
(bool result, List<object?>? parametersToResolve, NoMatchingConstructorFoundException? exception) = (bool result, List<object?>? parametersToResolve, NoMatchingConstructorFoundException? exception) =

Loading…
Cancel
Save