Example #1
0
        public PropertySerializationInfo(PropertyInfo property, int order = -1)
        {
            Property = property;
            Name     = property.Name;
            DataType = Property.PropertyType;
            var keys = PropertySerializationInfoKeys.None;

            if (TypeHelper.IsSerializeText(property))
            {
                keys |= PropertySerializationInfoKeys.Text;
            }
            else if (TypeHelper.IsSerializeAttribute(property))
            {
                keys |= PropertySerializationInfoKeys.Attribute;
            }
            if (TypeHelper.IsSerializeWriteable(property))
            {
                keys |= PropertySerializationInfoKeys.Writeable;
            }
            if (TypeHelper.IsRequired(property))
            {
                keys |= PropertySerializationInfoKeys.Required;
            }
            if (TypeHelper.IsJsonSynchronized(property))
            {
                keys |= PropertySerializationInfoKeys.ChangeSensitive;
            }
            if (TypeHelper.IsReadOnly(property))
            {
                keys |= PropertySerializationInfoKeys.ReadOnly;
            }
            Keys    = keys;
            Order   = TypeHelper.GetOrder(property, order);
            Invoker = EmitInvoker.Initialize(property, true);

            Default = TypeHelper.GetDefault(property);
            if (IsAttribute || IsText)
            {
                Serialazer = TypeHelper.GetValueSerializer(property);
            }
        }