コード例 #1
0
        public void ValidateOrThrow()
        {
            ProxySettingsValidation validation = Validate();

            if (!validation.Success)
            {
                throw new ProxySettingsValidationException(validation);
            }
        }
コード例 #2
0
        public ProxySettingsValidation Validate()
        {
            Args.ThrowIfNull(ServiceType, nameof(ServiceType));
            ProxySettingsValidation result = new ProxySettingsValidation();
            List <MethodInfo>       nonOverridableMethods = new List <MethodInfo>();

            ServiceProxySystem.GetProxiedMethods(ServiceType, IncludeLocalMethods)
            .Where(mi => !mi.IsOverridable())
            .Each(new { NonOverridableMethods = nonOverridableMethods }, (ctx, mi) => ctx.NonOverridableMethods.Add(mi));

            string nonVirtualMethodsMessage = $"Non virtual proxied methods were found; proxies cannot be automatically generated for the specified type {ServiceType.Namespace}.{ServiceType.Name} because proxyable methods were not declared virtual and will subsequently not properly delegate to the remote \"{Host}\"";

            nonVirtualMethodsMessage += $"\r\n\t{string.Join("\r\n\t", nonOverridableMethods.Select(m=> m.Name))}\r\n";
            result.Success            = nonOverridableMethods.Count == 0;
            result.Message            = result.Success ? string.Empty : nonVirtualMethodsMessage;
            result.NonVirtualMethods  = nonOverridableMethods.ToArray();
            return(result);
        }
コード例 #3
0
 public ProxySettingsValidationException(ProxySettingsValidation validation) : base(validation.Message)
 {
 }