Model Binding Use Case in ASP.NET Core

닷넷디벨·2023년 9월 5일
0

[FromBody]

Binding data from the request body of an HTTP request. this attribute is particularly useful when you need to receive Complex data, such as json or xml, from the client in the body of a POST or PUT request.

HTTP 요청의 요청 본문에서 데이터를 바인딩합니다. 이 속성은 POST 또는 PUT 요청 본문의 클라이언트로부터 json 또는 xml과 같은 복잡한 데이터를 수신해야 할 때 특히 유용합니다.

[FromForm]

Binding data from HTML form submissions or multipart/form-data requests. This attribute allows you to map data sent by the client through a form to action method parameters. It's particularly useful when you need to handle data submitted from HTML forms on web pages.

HTML 양식 제출 또는 다중 부분/양식 데이터 요청의 데이터 바인딩. 이 특성을 사용하면 폼에서 작업 방법 매개 변수를 통해 클라이언트가 전송한 데이터를 매핑할 수 있습니다. 웹 페이지의 HTML 양식에서 제출된 데이터를 처리해야 할 때 특히 유용합니다.

[FromHeader]

Binding data from HTTP headers in an HTTP request. This attribute allows you to access and use data present in the headers of the incoming request. It is commonly used to extract specific information such as authentication, custom headers, content negotiation, and other header-related operations.

HTTP 요청에서 HTTP 헤더의 데이터를 바인딩합니다. 이 속성을 사용하면 수신 요청의 헤더에 있는 데이터에 액세스하고 사용할 수 있습니다. 인증, 사용자 정의 헤더, 콘텐츠 협상 및 기타 헤더 관련 작업과 같은 특정 정보를 추출하는 데 일반적으로 사용됩니다.

[FromRoute]

Extracting values from the URL's path and using them within your endpoints.
It enables resource identification, clean URLs, API versioning, and handling complex route structures.

URL 경로에서 값을 추출하고 엔드포인트 내에서 값을 사용합니다. 리소스 식별, URL 정리, API 버전 관리 및 복잡한 경로 구조 처리를 가능하게 합니다.

[FromQuery]

Extracting and working with data provided in the query string of a URL. It enables scenarios such as filtering, searching, pagination, sorting, and more.

URL의 쿼리 문자열에 제공된 데이터를 추출하여 사용합니다. 필터링, 검색, 페이지 설정, 정렬 등의 시나리오를 사용할 수 있습니다.

profile
hardcore developer

0개의 댓글