-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathArgumentsSearchAPI.cs
More file actions
25 lines (22 loc) · 950 Bytes
/
ArgumentsSearchAPI.cs
File metadata and controls
25 lines (22 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using ServiceComposer.AspNetCore;
namespace Snippets.ModelBinding;
public class ArgumentsSearchAPI : ICompositionRequestsHandler
{
void Snippet(HttpRequest request)
{
#pragma warning disable SC0001
// begin-snippet: arguments-search-api
var ctx = request.GetCompositionContext();
var arguments = ctx.GetArguments(this);
var findValueByType = arguments.Argument<BodyModel>();
var findValueByTypeAndName = arguments.Argument<int>(name: "id");
var findValueByTypeAndSource = arguments.Argument<int>(bindingSource: BindingSource.Header);
var findValueByTypeSourceAndName = arguments.Argument<string>(name: "user", bindingSource: BindingSource.Query);
// end-snippet
#pragma warning restore SC0001
}
public Task Handle(HttpRequest request) => Task.CompletedTask;
}