From 4cf2a5839da8761f4f513c1a5bf89f378ed3720a Mon Sep 17 00:00:00 2001 From: Jarrett Vance Date: Mon, 6 Jan 2014 10:36:57 -0600 Subject: [PATCH] Fixed issue with same type being registered twice when using multiple implementation registration. --- src/TinyIoC/TinyIoC.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/TinyIoC/TinyIoC.cs b/src/TinyIoC/TinyIoC.cs index ba306ca..3025a68 100644 --- a/src/TinyIoC/TinyIoC.cs +++ b/src/TinyIoC/TinyIoC.cs @@ -3097,14 +3097,12 @@ where localType.IsAssignableFrom(implementationType) { RegisterMultiple(type, implementations); } - } - - var firstImplementation = implementations.FirstOrDefault(); - if (firstImplementation != null) + } + else if (implementations.Count() == 1) { try { - RegisterInternal(type, string.Empty, GetDefaultObjectFactory(type, firstImplementation)); + RegisterInternal(type, string.Empty, GetDefaultObjectFactory(type, implementations.First())); } catch (MethodAccessException) {