Ejemplo n.º 1
0
        internal static bool HasAttribute <T>(this JsonProperty jsonProperty) where T : Attribute
        {
            MemberInfo memberInfo;

            if (!jsonProperty.TryGetMemberInfo(out memberInfo))
            {
                return(false);
            }
            return((object)memberInfo.GetCustomAttribute <T>() != null);
        }
Ejemplo n.º 2
0
        private Schema CreatePropertySchema(
            JsonProperty jsonProperty,
            Queue <Type> referencedTypes)
        {
            Schema schema = this.CreateSchema(jsonProperty.PropertyType, referencedTypes);

            if (!jsonProperty.Writable)
            {
                schema.ReadOnly = new bool?(true);
            }
            MemberInfo memberInfo;

            if (jsonProperty.TryGetMemberInfo(out memberInfo))
            {
                schema.AssignAttributeMetadata((IEnumerable <object>)memberInfo.GetCustomAttributes(true));
            }
            return(schema);
        }