Skip to content

Conversation

@mikekistler
Copy link
Contributor

@mikekistler mikekistler commented Oct 1, 2024

Add examples for attributes

This PR just adds remarks and examples to the XML doc for some commonly used attributes.

Description

Add remarks and examples to the XML doc for some commonly used attributes in Web apps to improve the documentation that appears on Learn and in VS / VSCode.

The intent is to add doc for:

  • FromBody
  • FromForm
  • FromHeader
  • FromQuery
  • FromRoute
  • Produces
  • Produces<T>
  • ProducesResponseType
  • ProducesResponseType<T>

and maybe a few more.

This will help developers understand some quirks about the way attributes can be used, such as using named parameters to set properties of the attribute even when these are not present in any constructor.

Update: Scoped this PR to just the attributes for parameter binding.

@mikekistler mikekistler requested a review from a team as a code owner October 1, 2024 22:30
@ghost ghost added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Oct 1, 2024
@mikekistler mikekistler marked this pull request as draft October 1, 2024 22:31
@mikekistler mikekistler force-pushed the mdk/attribute-examples branch from 327292e to f7ec6fb Compare October 27, 2024 19:44
@mikekistler
Copy link
Contributor Author

I think this is ready for review now. I'll follow up with PRs for other attributes.

@mikekistler mikekistler marked this pull request as ready for review October 27, 2024 19:48
Copy link
Member

@captainsafia captainsafia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice stuff! Left some comments inline.

@mikekistler mikekistler merged commit 3f8edf1 into main Oct 30, 2024
27 checks passed
@mikekistler mikekistler deleted the mdk/attribute-examples branch October 30, 2024 02:40
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-preview1 milestone Oct 30, 2024
captainsafia pushed a commit that referenced this pull request Feb 11, 2025
* Add examples for a few Mvc attributes

* Scope to parameter binding attributes.

* Fixes from PR review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants