Пример #1
0
        public static T Execute(
            Func <T> func,
            ITransientFaultDetecter <Exception> detecter,
            int retryThreshold)
        {
            var handler = new DefaultTransientFaultHandler <T>(
                func,
                detecter,
                retryThreshold);

            return(handler.Execute());
        }
Пример #2
0
        public static string GetResponse(
            this string uri,
            Func <HttpWebRequest, HttpWebRequest> funcSetCustomSettings = null,
            Encoding defaultEncoding = null,
            ITransientFaultDetecter <Exception> faultDetecter = null,
            int retryThreshold = 5)
        {
            var faultHandler = new DefaultTransientFaultHandler <string>(
                () => { return(GetUriContentDirectly(uri, funcSetCustomSettings, defaultEncoding)); },
                faultDetecter ?? new DefaultHttpTransientFaultDetecter(),
                retryThreshold);

            return(faultHandler.Execute());
        }