Example #1
0
        public Task BuildAsync(IEntityBuilder builder)
        {
            var endpointDescriptor = this._endpointDescriptorProvider.GetEndpointDescriptor(this._captureExpression, this._claimsPrincipal);

            if (endpointDescriptor == null)
            {
                return(Task.CompletedTask);
            }

            var method = endpointDescriptor.Method;
            var href   = this._hrefFactory.MakeHref(endpointDescriptor);
            var fields = this._fieldsFactory.MakeFields(new ActionArgument(endpointDescriptor.BodyArgument.Descriptor, endpointDescriptor.BodyArgument.Value));

            var action = new Actions.Action(this._name, href, method, fields);

            if (this._configureActionBuilder != null)
            {
                var actionBuilder = new ActionBuilder <TBody>(action);

                this._configureActionBuilder(actionBuilder);
            }

            builder.WithAction(action);

            return(Task.CompletedTask);
        }