/// <summary>
 /// Formats a property
 /// </summary>
 /// <param name="property">The property</param>
 /// <returns>The string representation of the property</returns>
 public virtual string Format(TsProperty property)
 {
     using (var sbc = new StringBuilderContext(this))
     {
         Write("{0}{1}: {2};", Format(property.Name), property.Optional?"?":"", Format(property.Type));
         return(sbc.ToString());
     }
 }
	    private static PropertyTypeEnum GetPropertyTypeEnum(TsProperty property)
	    {
		    if (property.Type is TsPrimitive primitiveType)
		    {
			    switch (primitiveType.PrimitiveType)
			    {
					case PrimitiveType.Number:
						return PropertyTypeEnum.Number;
					case PrimitiveType.String:
						return PropertyTypeEnum.String;
					case PrimitiveType.Date:
						return PropertyTypeEnum.Date;
					case PrimitiveType.Boolean:
						return PropertyTypeEnum.Boolean;
				}
		    }
		    else if (property.Type is TsEnum)
		    {
			    return PropertyTypeEnum.Enum;
		    }

		    return PropertyTypeEnum.Object;
	    }
示例#3
0
        public override string Format(TsProperty property)
        {
            var result = base.Format(property);

            return(char.ToLower(result[0]) + (result.Length == 1 ? string.Empty : result.Substring(1)));
        }