Пример #1
0
 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);
 }
Пример #2
0
        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)));
            }
        }
Пример #3
0
        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);
        }
Пример #4
0
        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());
                }
            }
        }
Пример #5
0
 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;
 }
Пример #6
0
        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;
        }