public void AddBinding(IDiBinding binding) { bool alreadyAdded = bindings.ContainsKey(binding.IdentifierType); if (alreadyAdded) { throw new Exception($"Container builder already has a binding " + $"of type {binding.IdentifierType.Name} registered"); } bindings.Add(binding.IdentifierType, binding); }
public void AddNewCase(IDiBinding binding) { var newCase = new DiRootBindingItem(x => true, binding); if (currentIndex == items.Count) { items.Add(newCase); } else { items.Insert(currentIndex, newCase); } }
private void Bind(IDiBinding binding) { resolvingStack.Add(binding.IdentifierType); binding.Bind(this); if (binding.Value == null) { throw new Exception($"Object of type {binding.IdentifierType.Name} Binding returned a null object"); } resolvingStack.Remove(binding.IdentifierType); binding.Init(this); }
public DiRootBindingItem(Func <IDiContainer, bool> condition, IDiBinding binding) { Condition = condition; Binding = binding; }