public UriMtHelper(HttpRequestMessage req, PropertyTypeContextSurface propertyContext)
     : this(req) {
     assoc      = propertyContext.Property;
     spec       = propertyContext.OwningSpecification;
     cachedId   = "";
     cachedType = spec.DomainTypeName();
 }
示例#2
0
 public UriMtHelper(HttpRequestMessage req, PropertyTypeContextSurface propertyContext)
     : this(req) {
     assoc = propertyContext.Property;
     spec = propertyContext.OwningSpecification;
     cachedId = "";
     cachedType = spec.DomainTypeName();
 }
示例#3
0
        protected static object GetPropertyValue(HttpRequestMessage req, INakedObjectAssociationSurface property, INakedObjectSurface target, RestControlFlags flags, bool valueOnly = false)
        {
            INakedObjectSurface valueNakedObject = property.GetNakedObject(target);
            string title = RestUtils.SafeGetTitle(property, valueNakedObject);

            if (valueNakedObject == null)
            {
                return(null);
            }
            if (property.Specification.IsParseable() || property.Specification.IsCollection())
            {
                return(RestUtils.ObjectToPredefinedType(valueNakedObject.Object));
            }

            if (valueOnly)
            {
                return(RefValueRepresentation.Create(new ValueRelType(property, new UriMtHelper(req, valueNakedObject)), flags));
            }

            var helper    = new UriMtHelper(req, property.IsInline() ? target : valueNakedObject);
            var optionals = new List <OptionalProperty> {
                new OptionalProperty(JsonPropertyNames.Title, title)
            };

            if (property.IsEager(target))
            {
                optionals.Add(new OptionalProperty(JsonPropertyNames.Value, ObjectRepresentation.Create(valueNakedObject, req, flags)));
            }

            return(LinkRepresentation.Create(new ValueRelType(property, helper), flags, optionals.ToArray()));
        }
示例#4
0
 public UriMtHelper(HttpRequestMessage req, PropertyContextSurface propertyContext) : this(req) {
     assoc = propertyContext.Property;
     nakedObject = propertyContext.Target;
     spec = nakedObject.Specification;
     LinkObjectId oid = OidStrategyHolder.OidStrategy.GetOid(nakedObject);
     cachedId = oid.InstanceId;
     cachedType = oid.DomainType;
 }
 public UriMtHelper(HttpRequestMessage req, PropertyContextSurface propertyContext) : this(req) {
     assoc       = propertyContext.Property;
     nakedObject = propertyContext.Target;
     spec        = nakedObject.Specification;
     LinkObjectId oid = OidStrategyHolder.OidStrategy.GetOid(nakedObject);
     cachedId   = oid.InstanceId;
     cachedType = oid.DomainType;
 }
 public UriMtHelper(HttpRequestMessage req, INakedObjectAssociationSurface assoc)
     : this(req) {
     cachedId = "";
     if (assoc.IsCollection())
     {
         cachedType = assoc.IsASet() ? PredefinedType.Set.ToRoString() : PredefinedType.List.ToRoString();
     }
     else
     {
         cachedType = assoc.Specification.DomainTypeName();
     }
 }
示例#7
0
 public static int MemberOrder(this INakedObjectAssociationSurface nakedObjectAssociationSurface)
 {
     return(nakedObjectAssociationSurface.GetScalarProperty <int>(ScalarProperty.MemberOrder));
 }
示例#8
0
 public static string Description(this INakedObjectAssociationSurface nakedObjectAssociationSurface)
 {
     return(nakedObjectAssociationSurface.GetScalarProperty <string>(ScalarProperty.Description));
 }
示例#9
0
 public static int?MaxLength(this INakedObjectAssociationSurface nakedObjectAssociationSurface)
 {
     return(nakedObjectAssociationSurface.GetScalarProperty <int?>(ScalarProperty.MaxLength));
 }
示例#10
0
 public static string SafeGetTitle(INakedObjectAssociationSurface property, INakedObjectSurface valueNakedObject) {
     return valueNakedObject == null ? "" : property.GetTitle(valueNakedObject);
 }
示例#11
0
 public static object GetChoiceValue(HttpRequestMessage req, INakedObjectSurface item, INakedObjectAssociationSurface property, RestControlFlags flags) {
     return GetChoiceValue(item, new ChoiceRelType(property, new UriMtHelper(req, item)), flags);
 }
示例#12
0
 public static int AutoCompleteMinLength(this INakedObjectAssociationSurface nakedObjectAssociationSurface)
 {
     return(nakedObjectAssociationSurface.GetScalarProperty <int>(ScalarProperty.AutoCompleteMinLength));
 }
示例#13
0
 public static object GetChoiceValue(HttpRequestMessage req, INakedObjectSurface item, INakedObjectAssociationSurface property, RestControlFlags flags)
 {
     return(GetChoiceValue(item, new ChoiceRelType(property, new UriMtHelper(req, item)), flags));
 }
示例#14
0
 public ChoiceRelType(INakedObjectAssociationSurface property, UriMtHelper helper) : this(helper) {
     member = property;
 }
示例#15
0
 public UriMtHelper(HttpRequestMessage req, INakedObjectAssociationSurface assoc)
     : this(req) {
     cachedId = "";
     if (assoc.IsCollection()) {
         cachedType = assoc.IsASet() ? PredefinedType.Set.ToRoString() : PredefinedType.List.ToRoString();
     }
     else {
         cachedType = assoc.Specification.DomainTypeName();
     }
 }
示例#16
0
 public static bool IsInline(this INakedObjectAssociationSurface nakedObjectAssociationSurface)
 {
     return(nakedObjectAssociationSurface.GetScalarProperty <bool>(ScalarProperty.IsInline));
 }
示例#17
0
 public static string Mask(this INakedObjectAssociationSurface nakedObjectAssociationSurface)
 {
     return(nakedObjectAssociationSurface.GetScalarProperty <string>(ScalarProperty.Mask));
 }
示例#18
0
 public static string SafeGetTitle(INakedObjectAssociationSurface property, INakedObjectSurface valueNakedObject)
 {
     return(valueNakedObject == null ? "" : property.GetTitle(valueNakedObject));
 }
示例#19
0
 public static IDictionary <string, object> ExtensionData(this INakedObjectAssociationSurface nakedObjectAssociationSurface)
 {
     return(nakedObjectAssociationSurface.GetScalarProperty <IDictionary <string, object> >(ScalarProperty.ExtensionData));
 }
 public ChoiceRelType(INakedObjectAssociationSurface property, UriMtHelper helper) : this(helper) {
     member = property;
 }