Пример #1
0
        public static GetValueDelegate <TKey, TValue1, TValue2> Wrap(
            GetValueDelegate <TKey, TValue1, TValue2> getValues)
        {
            var factory = new FactoryWrapper <TKey, TValue1, TValue2>(getValues);

            return(factory.runTogether);
        }
Пример #2
0
        public static GetValueDelegate <TKey, TValue1, TValue2> Wrap(
            Func <TKey, TValue1> f1, Func <TKey, TValue2> f2, bool ExecuteParallelly = false)
        {
            var factory = new FactoryWrapper <TKey, TValue1, TValue2>(f1, f2);

            if (ExecuteParallelly)
            {
                return(factory.runParallel);
            }
            else
            {
                return(factory.runSequential);
            }
        }
 internal bool runTogether(TKey key, out DateTime timestamp, out TValue1 v1, out TValue2 v2)
 {
     try
     {
         bool result = getAllValues.Invoke(key, out v1, out v2);
         timestamp = _funDateTime.Invoke(key);
         return(result);
     }
     catch (Exception)
     {
         return(FactoryWrapper <TKey, DateTime, TValue1, TValue2>
                .ResetAll(key, out timestamp, out v1, out v2));
     }
 }