public void AddKey(ContainerKey key) { if (_keys.Contains(key)) { throw new ContainerException($"Trying to add duplicate ContainerKey {key}!"); } _keys.Add(key); }
public ContainerRegistry As <T>() { var objectType = ObjectProvider.GetObjectType(); var parentType = typeof(T); if (!parentType.IsAssignableFrom(objectType)) { throw new ContainerException($"{objectType} isn't subclass of {parentType}"); } var key = new ContainerKey(typeof(T), _cachedName); AddKey(key); _geckoContainer.AddContainerRegistry(key, this); return(this); }