/// <summary> /// Define beanName to be resolver for a single interface type. /// Only one resolver config per interface is allowed. /// </summary> /// <param name="Tinterface">Type of the interface where the class is annotated with the bean.</param> /// <param name="beanName">Name or identifier of the bean</param> /// <param name="throwIfNotFound">Should an exception must thrown if not found?</param> public void UseBeanName(Type Tinterface, string beanName, bool throwIfNotFound = false) { if (InterfaceNameBag.ContainsKey(Tinterface)) { InterfaceNameBag.Remove(Tinterface); } InterfaceNameBag.Add(Tinterface, new BeanConfig(beanName, throwIfNotFound)); }
/// <summary> /// Get BeanConfig configuration for a single interface type. /// If no configuration found, global configuration will be used. /// </summary> /// <param name="Tinterface">Type of the interface where the class is annotated with the bean.</param> /// <returns>Bean Configuration to be used.</returns> public BeanConfig FindBeanConfig(Type Tinterface) => InterfaceNameBag.GetValueOrDefault(Tinterface, GlobalBeanName);