-
-
Notifications
You must be signed in to change notification settings - Fork 746
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proposal: Add a
TreatAsString
field to QueryAttribute
The proposal arises from the need to pass custom types or structs which might represent types with rules and conversions. For example: ```csharp record readonly struct ZipCode(ushort ZipCode) { public override string ToString() => ZipCode.ToString(); } ``` To solve the problem the proposal seeks to add a field to the QueryAttribute called `TreatAsString`. The new field is used when the query string is created and simply calls the `ToString()` function on a type. There is a workaround that is not documented. The current workaround is to implement `IFormattable` on the type, which feels redundant if `ToString()` is already implemented on a custom type.
- Loading branch information
Showing
3 changed files
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters