private void SetScalars(ActionTypeContextFacade 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;
 }
 private void SetParameters(HttpRequestMessage req, ActionTypeContextFacade actionTypeContext) {
     IEnumerable<LinkRepresentation> parms = actionTypeContext.ActionContext.VisibleParameters.
         Select(p => LinkRepresentation.Create(OidStrategy,new ParamTypeRelType(new UriMtHelper(OidStrategy, req, new ParameterTypeContextFacade {
             Action = actionTypeContext.ActionContext.Action,
             OwningSpecification = actionTypeContext.OwningSpecification,
             Parameter = p.Parameter
         })), Flags));
     Parameters = parms.ToArray();
 }
 protected ActionTypeRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, ActionTypeContextFacade actionTypeContext, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SelfRelType = new TypeMemberRelType(RelValues.Self, new UriMtHelper(oidStrategy ,req, actionTypeContext));
     SetScalars(actionTypeContext);
     SetLinks(req, actionTypeContext);
     SetParameters(req, actionTypeContext);
     SetExtensions();
     SetHeader();
 }
        private void SetLinks(HttpRequestMessage req, ActionTypeContextFacade actionTypeContext) {
            var domainTypeUri = new UriMtHelper(OidStrategy, req, actionTypeContext);
            var tempLinks = new List<LinkRepresentation> {
                LinkRepresentation.Create(OidStrategy, SelfRelType, Flags),
                LinkRepresentation.Create(OidStrategy ,new DomainTypeRelType(RelValues.Up, domainTypeUri), Flags),
                LinkRepresentation.Create(OidStrategy, new DomainTypeRelType(RelValues.ReturnType, new UriMtHelper(OidStrategy, req, actionTypeContext.ActionContext.Action.ReturnType)), Flags)
            };

            if (actionTypeContext.ActionContext.Action.ReturnType.IsCollection) {
                tempLinks.Add(LinkRepresentation.Create(OidStrategy ,new DomainTypeRelType(RelValues.ElementType, new UriMtHelper(OidStrategy, req, actionTypeContext.ActionContext.Action.ElementType)), Flags));
            }

            Links = tempLinks.ToArray();
        }
 public static ActionTypeRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, ActionTypeContextFacade actionTypeContext, RestControlFlags flags) {
     return new ActionTypeRepresentation(oidStrategy, req, actionTypeContext, flags);
 }
Ejemplo n.º 6
0
        public RestSnapshot(IOidStrategy oidStrategy, ActionTypeContextFacade actionTypeContext, HttpRequestMessage req, RestControlFlags flags)
            : this(oidStrategy,req, true) {
            logger.DebugFormat("RestSnapshot:{0}", actionTypeContext.GetType().FullName);

            populator = () => {
                representation = ActionTypeRepresentation.Create(oidStrategy ,req, actionTypeContext, flags);
                SetHeaders();
            };
        }
Ejemplo n.º 7
0
 public UriMtHelper(IOidStrategy oidStrategy, HttpRequestMessage req, ActionTypeContextFacade actionTypeContext)
     : this(oidStrategy ,req) {
     action = actionTypeContext.ActionContext.Action;
     spec = actionTypeContext.OwningSpecification;
     cachedId = "";
     CachedType = spec.DomainTypeName(oidStrategy);
 }