コード例 #1
0
 protected InlineActionRepresentation(ActionRepresentationStrategy strategy) : base(strategy.GetFlags()) {
     MemberType = MemberTypes.Action;
     Id = strategy.GetId();
     Parameters = strategy.GetParameters();
     Links = strategy.GetLinks(false);
     Extensions = strategy.GetExtensions();
     SetHeader(strategy.GetTarget());
 }
コード例 #2
0
 protected ActionRepresentation(ActionRepresentationStrategy strategy) : base(strategy.GetFlags()) {
     SelfRelType = strategy.GetSelf();
     Id = strategy.GetId();
     Parameters = strategy.GetParameters();
     Links = strategy.GetLinks(true);
     Extensions = strategy.GetExtensions();
     SetHeader(strategy.GetTarget());
 }
コード例 #3
0
        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);
        }