Esempio n. 1
0
        // Serialization of ref type elements that uses ref type caching (string and so on)
        private T[] DeserializeInternal(BaseSerializerInfo <T> serializerInfo, IRefTypeObjectsDictionary objectCache)
        {
            Action <int, T[]> action = (arrayLength, outputArray) =>
            {
                // Serializer of an element
                ICachedObjectSerializer <T> serializer = (serializerInfo as CachedRefObjectSerializerInfo <T>).FactoryFunc(SerializerStorage, objectCache);

                // Deserialize all the elems
                for (int pos = 0; pos < arrayLength; pos++)
                {
                    T value = serializer.Deserialize();
                    outputArray[pos] = value;
                }
            };

            return(DeserializeInternal(action));
        }
Esempio n. 2
0
        // Serialization of ref type elements that uses ref type caching (string and so on)
        private void SerializeInternal(T[] valueToSerialize, BaseSerializerInfo <T> serializerInfo, IRefTypeObjectsDictionary objectCache)
        {
            Action arraySerializationAction = () =>
            {
                // Serializer of an element
                ICachedObjectSerializer <T> serializer = (serializerInfo as CachedRefObjectSerializerInfo <T>).FactoryFunc(SerializerStorage, objectCache);

                // Serialize all the elems
                for (int pos = 0; pos < valueToSerialize.Length; pos++)
                {
                    serializer.Serialize(valueToSerialize[pos]);
                }
            };

            SerializeInternal(valueToSerialize, arraySerializationAction);
        }
 // Constructor
 public PerfTests_Classes_AzureEntityFramework_AddressSerializer(ISerializerStorage serializerStorage, IRefTypeObjectsDictionary refObjectsCache, IValueTypeObjectsDictionary valObjectsCache)
     : base(serializerStorage, refObjectsCache, valObjectsCache)
 {
 }