public UriMtHelper(HttpRequestMessage req, PropertyTypeContextSurface propertyContext) : this(req) { assoc = propertyContext.Property; spec = propertyContext.OwningSpecification; cachedId = ""; cachedType = spec.DomainTypeName(); }
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())); }
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(); } }
public static int MemberOrder(this INakedObjectAssociationSurface nakedObjectAssociationSurface) { return(nakedObjectAssociationSurface.GetScalarProperty <int>(ScalarProperty.MemberOrder)); }
public static string Description(this INakedObjectAssociationSurface nakedObjectAssociationSurface) { return(nakedObjectAssociationSurface.GetScalarProperty <string>(ScalarProperty.Description)); }
public static int?MaxLength(this INakedObjectAssociationSurface nakedObjectAssociationSurface) { return(nakedObjectAssociationSurface.GetScalarProperty <int?>(ScalarProperty.MaxLength)); }
public static string SafeGetTitle(INakedObjectAssociationSurface property, INakedObjectSurface valueNakedObject) { return valueNakedObject == null ? "" : property.GetTitle(valueNakedObject); }
public static object GetChoiceValue(HttpRequestMessage req, INakedObjectSurface item, INakedObjectAssociationSurface property, RestControlFlags flags) { return GetChoiceValue(item, new ChoiceRelType(property, new UriMtHelper(req, item)), flags); }
public static int AutoCompleteMinLength(this INakedObjectAssociationSurface nakedObjectAssociationSurface) { return(nakedObjectAssociationSurface.GetScalarProperty <int>(ScalarProperty.AutoCompleteMinLength)); }
public static object GetChoiceValue(HttpRequestMessage req, INakedObjectSurface item, INakedObjectAssociationSurface property, RestControlFlags flags) { return(GetChoiceValue(item, new ChoiceRelType(property, new UriMtHelper(req, item)), flags)); }
public ChoiceRelType(INakedObjectAssociationSurface property, UriMtHelper helper) : this(helper) { member = property; }
public static bool IsInline(this INakedObjectAssociationSurface nakedObjectAssociationSurface) { return(nakedObjectAssociationSurface.GetScalarProperty <bool>(ScalarProperty.IsInline)); }
public static string Mask(this INakedObjectAssociationSurface nakedObjectAssociationSurface) { return(nakedObjectAssociationSurface.GetScalarProperty <string>(ScalarProperty.Mask)); }
public static string SafeGetTitle(INakedObjectAssociationSurface property, INakedObjectSurface valueNakedObject) { return(valueNakedObject == null ? "" : property.GetTitle(valueNakedObject)); }
public static IDictionary <string, object> ExtensionData(this INakedObjectAssociationSurface nakedObjectAssociationSurface) { return(nakedObjectAssociationSurface.GetScalarProperty <IDictionary <string, object> >(ScalarProperty.ExtensionData)); }