Ejemplo n.º 1
0
        public static object TargetByAttribute(this FeignBuilder builder, Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            var feignClientAttribute = type.GetCustomAttribute <FeignClientAttribute>();

            if (feignClientAttribute == null)
            {
                throw new ArgumentException("can't find FeignClient Attribute.");
            }

            return(builder
                   .ClientName(feignClientAttribute.Name)
                   .FallbackType(feignClientAttribute.FallbackType)
                   .Target(type));
        }
Ejemplo n.º 2
0
 public static T TargetByAttribute <T>(this FeignBuilder builder)
 {
     return((T)builder.TargetByAttribute(typeof(T)));
 }