public static bool IsBlobOrClob(INakedObjectSpecificationSurface spec) { if (spec.IsParseable() || spec.IsCollection()) { Type underlyingType = spec.GetUnderlyingType(); PredefinedType pdt = TypeToPredefinedType(underlyingType); return(pdt == PredefinedType.Blob || pdt == PredefinedType.Clob); } return(false); }
public void AddActionResultRepresentationParameter(MediaTypeHeaderValue mediaType, RestControlFlags flags) { INakedObjectSpecificationSurface resultSpec = action.ReturnType; bool isCollection = resultSpec.IsCollection() && !resultSpec.IsParseable(); INakedObjectSpecificationSurface parameterValueSpec = isCollection ? action.ElementType : resultSpec; string parameterValue = GetParameterValue(flags, parameterValueSpec); if (parameterValue != null) { string parameterType = isCollection ? RestControlFlags.ElementTypeReserved : RestControlFlags.DomainTypeReserved; mediaType.Parameters.Add(new NameValueHeaderValue(parameterType, string.Format("\"{0}\"", parameterValue))); } }
public static PredefinedType?SpecToPredefinedType(INakedObjectSpecificationSurface spec) { if (spec.IsFileAttachment() || spec.IsImage()) { return(PredefinedType.Blob); } if (spec.IsParseable() || spec.IsCollection() || spec.IsVoid()) { Type underlyingType = spec.GetUnderlyingType(); return(TypeToPredefinedType(underlyingType)); } return(null); }
protected static void AddStringProperties(INakedObjectSpecificationSurface spec, int?maxLength, string pattern, Dictionary <string, object> exts) { if (spec.IsParseable()) { if (maxLength != null) { exts.Add(JsonPropertyNames.MaxLength, maxLength); } if (!string.IsNullOrEmpty(pattern)) { exts.Add(JsonPropertyNames.Pattern, pattern); } if (spec.IsDateTime()) { exts.Add(JsonPropertyNames.Format, PredefinedType.Date_time.ToRoString()); } } }
public static bool IsBlobOrClob(INakedObjectSpecificationSurface spec) { if (spec.IsParseable() || spec.IsCollection()) { Type underlyingType = spec.GetUnderlyingType(); PredefinedType pdt = TypeToPredefinedType(underlyingType); return pdt == PredefinedType.Blob || pdt == PredefinedType.Clob; } return false; }
public static PredefinedType? SpecToPredefinedType(INakedObjectSpecificationSurface spec) { if (spec.IsFileAttachment() || spec.IsImage()) { return PredefinedType.Blob; } if (spec.IsParseable() || spec.IsCollection() || spec.IsVoid()) { Type underlyingType = spec.GetUnderlyingType(); return TypeToPredefinedType(underlyingType); } return null; }