コード例 #1
0
        //public virtual CobServiceDescriptor Clone()
        //{
        //    return new CobServiceDescriptor
        //    {
        //        ServiceName = ServiceName,
        //        Path = Path,
        //        Retry = Retry,
        //        Timeout = Timeout,
        //        Transport = Transport,
        //        //Formatter = Formatter
        //    };
        //}

        /// <summary>
        /// 使用<paramref name="refer"/>中的非空值覆盖当前值, 但Path/RetryExceptionTypes为合并
        /// </summary>
        /// <param name="refer"></param>
        /// <returns></returns>
        internal protected virtual CobServiceDescription Refer(CobServiceDescription refer)
        {
            AssignByValidValue(this.ServiceName, refer.ServiceName, v => ServiceName = v);

            if (HasValue(Path) && HasValue(refer.Path))
            {
                Path = UriHelper.Combine(refer.Path, Path);// AssignByValidValue(this.Path, refer.Path, v => );
            }
            AssignByValidValue(this.RetryTimes, refer.RetryTimes, v => RetryTimes                = v);
            AssignByValidValue(this.Timeout, refer.Timeout, v => Timeout                         = v);
            AssignByValidValue(this.Transport, refer.Transport, v => Transport                   = v);
            AssignByValidValue(this.FallbackValue, refer.FallbackValue, v => FallbackValue       = v);
            AssignByValidValue(this.FallbackHandler, refer.FallbackHandler, v => FallbackHandler = v);

            if (HasValue(refer.RetryExceptionTypes))
            {
                this.RetryExceptionTypes = (this.RetryExceptionTypes ?? new Type[0]).Concat(refer.RetryExceptionTypes).ToArray();
            }

            //AssignByValidValue(this.Formatter, refer.Formatter, v => Formatter = v);

            AssignByValidValue(this.ResolveServiceName, refer.ResolveServiceName, v => ResolveServiceName = v);


            if (HasValue(refer.Filters))
            {
                this.Filters = refer.Filters.Concat(this.Filters ?? new ICobRequestFilter[0]).ToArray();//refer的filter在方法的前面
            }
            return(this);
        }
コード例 #2
0
        //public virtual CobServiceDescriptor Clone()
        //{
        //    return new CobServiceDescriptor
        //    {
        //        ServiceName = ServiceName,
        //        Path = Path,
        //        Retry = Retry,
        //        Timeout = Timeout,
        //        Transport = Transport,
        //        //Formatter = Formatter
        //    };
        //}

        /// <summary>
        /// 使用<paramref name="refer"/>中的非空值覆盖当前值, 但Path/RetryExceptionTypes为合并
        /// </summary>
        /// <param name="refer"></param>
        /// <returns></returns>
        public virtual CobServiceDescription Refer(CobServiceDescription refer)
        {
            AssignByValidValue(this.ServiceName, refer.ServiceName, v => ServiceName = v);

            if (HasValue(Path) && HasValue(refer.Path))
            {
                Path = UriHelper.Combine(refer.Path, Path);// AssignByValidValue(this.Path, refer.Path, v => );
            }
            AssignByValidValue(this.RetryTimes, refer.RetryTimes, v => RetryTimes                = v);
            AssignByValidValue(this.Timeout, refer.Timeout, v => Timeout                         = v);
            AssignByValidValue(this.Transport, refer.Transport, v => Transport                   = v);
            AssignByValidValue(this.FallbackValue, refer.FallbackValue, v => FallbackValue       = v);
            AssignByValidValue(this.FallbackHandler, refer.FallbackHandler, v => FallbackHandler = v);

            if (HasValue(refer.RetryExceptionTypes))
            {
                this.RetryExceptionTypes = (this.RetryExceptionTypes ?? new Type[0]).Concat(refer.RetryExceptionTypes).ToArray();
            }

            //AssignByValidValue(this.Formatter, refer.Formatter, v => Formatter = v);

            return(this);
        }
コード例 #3
0
        public override CobServiceDescription Refer(CobServiceDescription refer)
        {
            this.Parent = refer;

            return(base.Refer(refer));
        }
コード例 #4
0
        internal protected override CobServiceDescription Refer(CobServiceDescription refer)
        {
            this.Parent = refer;

            return(base.Refer(refer));
        }