/// <inheriteddoc /> public IEnumerable <object> GetAllInstances(Type serviceType, object key) { if (serviceType == null) { throw new ArgumentNullException("serviceType"); } IEnumerable <object> result = null; ServiceActivationException exceptionToThrow = null; try { result = this.OnGetAllInstances(serviceType, key); if (result == null) { exceptionToThrow = new ServiceActivationException(serviceType, null); } } catch (Exception ex) { exceptionToThrow = new ServiceActivationException(serviceType, null, ex); } if (exceptionToThrow != null) { throw exceptionToThrow; } using (IEnumerator <object> e = result.GetEnumerator()) { while (e.MoveNext()) { object obj = ParseValue(e.Current); if (obj != null) { yield return(obj); } } } }
/// <inheriteddoc /> public object GetInstance(Type serviceType, object key) { if (serviceType == null) { throw new ArgumentNullException("serviceType"); } object result = null; ServiceActivationException exceptionToThrow = null; try { result = ParseValue(this.OnGetInstance(serviceType, ParseValue(key))); if (result == null) { exceptionToThrow = new ServiceActivationException(serviceType, key); } } catch (Exception ex) { exceptionToThrow = new ServiceActivationException(serviceType, key, ex); } if (exceptionToThrow != null) { throw exceptionToThrow; } return(result); }