예제 #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 GetUriContent(
            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());
        }