示例#1
0
 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();
 }
示例#2
0
 public UriMtHelper(HttpRequestMessage req, ActionTypeContextSurface actionTypeContext)
     : this(req) {
     action = actionTypeContext.ActionContext.Action;
     spec = actionTypeContext.OwningSpecification;
     cachedId = "";
     cachedType = spec.DomainTypeName();
 }
示例#3
0
 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();
 }
示例#4
0
 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();
 }
示例#5
0
        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();
        }
示例#6
0
 public static ActionTypeRepresentation Create(HttpRequestMessage req, ActionTypeContextSurface actionTypeContext, RestControlFlags flags) {
     return new ActionTypeRepresentation(req, actionTypeContext, flags);
 }
示例#7
0
        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();
            };
        }