public UriMtHelper(HttpRequestMessage req, ActionContextSurface actionContext) : this(req) { action = actionContext.Action; nakedObject = actionContext.Target; spec = nakedObject.Specification; LinkObjectId oid = OidStrategyHolder.OidStrategy.GetOid(nakedObject); cachedId = oid.InstanceId; cachedType = oid.DomainType; }
public static InlineActionRepresentation Create(HttpRequestMessage req, ActionContextSurface actionContext, RestControlFlags flags) { IConsentSurface consent = actionContext.Action.IsUsable(actionContext.Target); var actionRepresentationStrategy = new ActionRepresentationStrategy(req, actionContext, flags); if (consent.IsVetoed) { var optionals = new List<OptionalProperty> {new OptionalProperty(JsonPropertyNames.DisabledReason, consent.Reason)}; return CreateWithOptionals<InlineActionRepresentation>(new object[] {actionRepresentationStrategy}, optionals); } return new InlineActionRepresentation(actionRepresentationStrategy); }
protected ListRepresentation(ObjectContextSurface objectContext, HttpRequestMessage req, RestControlFlags flags, ActionContextSurface actionContext) : base(flags) { INakedObjectSurface list; if (flags.PageSize > 0 && objectContext.Target.Count() > flags.PageSize) { warnings.Add(string.Format("Result contains more than {0} objects only returning the first {0}", flags.PageSize)); list = objectContext.Target.Page(1, flags.PageSize); } else { list = objectContext.Target; } Value = list.ToEnumerable().Select(no => CreateObjectLink(req, no)).ToArray(); SetLinks(req, actionContext); SetExtensions(); SetHeader(false); }
public ActionRepresentationStrategy(HttpRequestMessage req, ActionContextSurface actionContext, RestControlFlags flags) : base(flags) { this.req = req; this.actionContext = actionContext; self = new MemberRelType(RelValues.Self, new UriMtHelper(req, actionContext)); parameterList = GetParameterList(); }
private void SetLinks(HttpRequestMessage req, ActionContextSurface actionContext) { SetLinks(req, actionContext.Specification.ElementType); }
public static ActionRepresentation Create(HttpRequestMessage req, ActionContextSurface actionContext, RestControlFlags flags) { return new ActionRepresentation(new ActionRepresentationStrategy(req, actionContext, flags)); }
public RestSnapshot(ActionContextSurface actionContext, HttpRequestMessage req, RestControlFlags flags) : this(actionContext, req, true) { populator = () => { representation = ActionRepresentation.Create(req, actionContext, flags); SetHeaders(); }; }