abpframework / abpframework/abp
Support strong typing of ids and other controller action parameters
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 14.4k
- Forks
- 3.7k
- Avg merge
- 15h 32m
- Merged PRs (30d)
- 106
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
I am try to implement strongly typed identifiers for my entities. These identifiers are created in the Domain.Shared project and are available to application service clients. Most of this is working, however, the ConventionalRouteBuilder, does not view these types as being primitives (because TypeHelper.IsPrimitiveExtended(...) returns false, and so the route builder creates query parameters for all of the properties of the type.
Describe the solution you'd like
I would like to see the logic currently implemented in TypeHelper.IsPrimitiveExtended() moved out to a separate dependency so that this mechanism is not so brittle. This would assist those of us wanting to tweak the way application services are exposed conventionally as controllers.
While it is possible to replace ConventionalRouteBuilder, this introduces potential inconsistencies in the way strongly typed values, are then treated in other areas that also call `TypeHelper.IsPrimitiveExtended()', such as validation, api description providers and object extending.
I note that ABP have recently had to modify this method to support the new DateOnly and TimeOnly types in .NET. Having this logic separated out might assist with these type of modifications in future.
Alternatively, TypeHelper.IsPrimitiveExtended() should better match the approach built into ASP.NET Core - i.e. if the type has a type converter that supports conversion from a single string, then it can be assumed to be a 'primitive type' when used as an action parameter.
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing TypeHelper.IsPrimitiveExtended and its callers, including ConventionalRouteBuilder, validation, API description providers, and object extending. Compare the current behavior with ASP.NET Core's simple-type and type-converter model-binding guidance; done means a decided, consistent approach for strongly typed action parameters across those areas.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100