private void SetScalars(ActionTypeContextSurface actionTypeContext) { Id = actionTypeContext.ActionContext.Id; FriendlyName = actionTypeContext.ActionContext.Action.Name(); Description = actionTypeContext.ActionContext.Action.Description(); HasParams = actionTypeContext.ActionContext.VisibleParameters.Any(); MemberOrder = actionTypeContext.ActionContext.Action.MemberOrder(); }
public UriMtHelper(HttpRequestMessage req, ActionTypeContextSurface actionTypeContext) : this(req) { action = actionTypeContext.ActionContext.Action; spec = actionTypeContext.OwningSpecification; cachedId = ""; cachedType = spec.DomainTypeName(); }
protected ActionTypeRepresentation(HttpRequestMessage req, ActionTypeContextSurface actionTypeContext, RestControlFlags flags) : base(flags) { SelfRelType = new TypeMemberRelType(RelValues.Self, new UriMtHelper(req, actionTypeContext)); SetScalars(actionTypeContext); SetLinks(req, actionTypeContext); SetParameters(req, actionTypeContext); SetExtensions(); SetHeader(); }
private void SetParameters(HttpRequestMessage req, ActionTypeContextSurface actionTypeContext) { IEnumerable<LinkRepresentation> parms = actionTypeContext.ActionContext.VisibleParameters. Select(p => LinkRepresentation.Create(new ParamTypeRelType(new UriMtHelper(req, new ParameterTypeContextSurface { Action = actionTypeContext.ActionContext.Action, OwningSpecification = actionTypeContext.OwningSpecification, Parameter = p.Parameter })), Flags)); Parameters = parms.ToArray(); }
private void SetLinks(HttpRequestMessage req, ActionTypeContextSurface actionTypeContext) { var domainTypeUri = new UriMtHelper(req, actionTypeContext); var tempLinks = new List<LinkRepresentation> { LinkRepresentation.Create(SelfRelType, Flags), LinkRepresentation.Create(new DomainTypeRelType(RelValues.Up, domainTypeUri), Flags), LinkRepresentation.Create(new DomainTypeRelType(RelValues.ReturnType, new UriMtHelper(req, actionTypeContext.ActionContext.Action.ReturnType)), Flags) }; if (actionTypeContext.ActionContext.Action.ReturnType.IsCollection()) { tempLinks.Add(LinkRepresentation.Create(new DomainTypeRelType(RelValues.ElementType, new UriMtHelper(req, actionTypeContext.ActionContext.Action.ReturnType.ElementType)), Flags)); } Links = tempLinks.ToArray(); }
public static ActionTypeRepresentation Create(HttpRequestMessage req, ActionTypeContextSurface actionTypeContext, RestControlFlags flags) { return new ActionTypeRepresentation(req, actionTypeContext, flags); }
public RestSnapshot(ActionTypeContextSurface actionTypeContext, HttpRequestMessage req, RestControlFlags flags) : this(req, true) { logger.DebugFormat("RestSnapshot:{0}", actionTypeContext.GetType().FullName); populator = () => { representation = ActionTypeRepresentation.Create(req, actionTypeContext, flags); SetHeaders(); }; }