Using NotMapped annotation on Id Property throws UnhandledException
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to implement some logic which will redact from the OData response a value which has been marked as a primary key. When the application then spins up I get an error similar to the following:
The entity set 'Foo' is based on type 'Default.Foo' that has no keys defined.
I get that the framework is trying to enforce well-defined keys here, but this sadly doesn't fit my use case. Are there any known workaround to this other than creating a custom ODataEntitySerializer?
Contributor guide
No contributing guide indexed for this repository
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
No files or tests are named. Start by reproducing startup with a NotMapped annotation on an Id property and trace the entity-set key validation; compare that behavior with the custom ODataEntitySerializer mentioned in the report. Done means identifying and documenting a supported workaround for redacting the primary-key value without leaving the entity set keyless.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100