Exemplo n.º 1
0
        private void _IteratePropertiesUntilEndOfFileIsReached(BinaryReader br, CycleCache cache, Type typeResolved, object instance)
        {
            KeyValuePair <string, object> propertyPair = _Deserialize(br, cache);

            while (propertyPair.Key != END_OF_INSTANCE)
            {
                SerializationCache serializationCache;
                if (_propertyCache[typeResolved].TryGetValue(propertyPair.Key, out serializationCache))
                {
                    serializationCache.SetMethod(instance, propertyPair.Value);
                }
                else
                {
                    // unknown property, see if it should be converted or ignored
                    ISterlingPropertyConverter propertyConverter;
                    if (_database.TryGetPropertyConverter(typeResolved, out propertyConverter))
                    {
                        propertyConverter.SetValue(instance, propertyPair.Key, propertyPair.Value);
                    }
                }

                propertyPair = _Deserialize(br, cache);
            }
        }