public bool Unbind <TContract>(object identifier) { FlushBindings(); var bindingId = new BindingId(typeof(TContract), identifier); return(providers.Remove(bindingId)); }
List <ProviderInfo> GetLocalProviders(BindingId bindingId) { List <ProviderInfo> localProviders; if (providers.TryGetValue(bindingId, out localProviders)) { return(localProviders); } return(new List <ProviderInfo>()); }
public override bool Equals(object other) { if (other is BindingId) { BindingId otherId = (BindingId)other; return(otherId == this); } else { return(false); } }
public void RegisterProvider(BindingId bindingId, BindingCondition condition, IProvider provider) { var info = new ProviderInfo(provider, condition); if (providers.ContainsKey(bindingId)) { providers[bindingId].Add(info); } else { providers.Add(bindingId, new List <ProviderInfo>() { info }); } }
IEnumerable <ProviderInfo> GetProvidersForContract(BindingId bindingId) { return(GetLocalProviders(bindingId).Select(p => p)); }
public bool Equals(BindingId that) { return(this == that); }