Esempio n. 1
0
        internal static ReliableStateKind KindOfReliableState(IReliableState reliableState)
        {
            var reliableStateType = reliableState.GetType();

            if (GenericUtils.IsSubClassOfGeneric(reliableStateType, typeof(IReliableDictionary <,>)))
            {
                return(ReliableStateKind.ReliableDictionary);
            }
            else if (GenericUtils.IsSubClassOfGeneric(reliableStateType, typeof(IReliableQueue <>)))
            {
                return(ReliableStateKind.ReliableQueue);
            }
            else if (GenericUtils.IsSubClassOfGeneric(reliableStateType, typeof(IReliableConcurrentQueue <>)))
            {
                return(ReliableStateKind.ReliableConcurrentQueue);
            }

            throw new ArgumentException("Type {0} is not supported.", reliableStateType.FullName);
        }
 private IList <Type> GetSerializationTypes(Type t)
 {
     if (GenericUtils.IsSubClassOfGeneric(t, typeof(IReliableDictionary <,>)))
     {
         var ts = new List <Type>()
         {
             typeof(NotifyDictionaryItemAddedEventArgs <,>).MakeGenericType(t.GetGenericArguments()),
             typeof(NotifyDictionaryClearEventArgs <,>).MakeGenericType(t.GetGenericArguments()),
             typeof(NotifyDictionaryItemRemovedEventArgs <,>).MakeGenericType(t.GetGenericArguments()),
             typeof(NotifyDictionaryItemUpdatedEventArgs <,>).MakeGenericType(t.GetGenericArguments()),
             typeof(NotifyDictionaryRebuildEventArgs <,>).MakeGenericType(t.GetGenericArguments()),
             t
         };
         ts.AddRange(t.GetGenericArguments());
         return(ts);
     }
     else
     {
         return(new List <Type>()
         {
             t
         });
     }
 }