Example #1
0
        private void SetPropertyOnObject <T>(PropertyInfo typeProperty, T newItem) where T : new()
        {
            if (TableConstants.ReservedPropertyNames.Contains(typeProperty.Name))
            {
                return;
            }

            IObjectToTypeConverter objectConverter = ObjectConverterFactory.GetConverterFor(typeProperty.PropertyType);

            typeProperty.SetValue(newItem, objectConverter.ConvertToValue(_properties[typeProperty.Name], typeProperty), null);
        }
Example #2
0
        private static Dictionary <string, EntityProperty> GetProperties(Dictionary <string, Tuple <object, Type> > properties)
        {
            var entityProperties = new Dictionary <string, EntityProperty>();

            foreach (KeyValuePair <string, Tuple <object, Type> > property in properties)
            {
                Type propertyType = property.Value.Item2;

                IObjectToTypeConverter converter = ObjectConverterFactory.GetConverterFor(propertyType);
                entityProperties[property.Key] = converter.ConvertToEntityProperty(property.Value.Item1, propertyType);
            }

            return(entityProperties);
        }