示例#1
0
        public bool Unbind <TContract>(object identifier)
        {
            FlushBindings();

            var bindingId = new BindingId(typeof(TContract), identifier);

            return(providers.Remove(bindingId));
        }
示例#2
0
        List <ProviderInfo> GetLocalProviders(BindingId bindingId)
        {
            List <ProviderInfo> localProviders;

            if (providers.TryGetValue(bindingId, out localProviders))
            {
                return(localProviders);
            }
            return(new List <ProviderInfo>());
        }
示例#3
0
 public override bool Equals(object other)
 {
     if (other is BindingId)
     {
         BindingId otherId = (BindingId)other;
         return(otherId == this);
     }
     else
     {
         return(false);
     }
 }
示例#4
0
        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
                });
            }
        }
示例#5
0
 IEnumerable <ProviderInfo> GetProvidersForContract(BindingId bindingId)
 {
     return(GetLocalProviders(bindingId).Select(p => p));
 }
示例#6
0
 public bool Equals(BindingId that)
 {
     return(this == that);
 }