SSWConsulting / SSWConsulting/SSW.CleanArchitecture

🐛 Investigate use of Nullable Strongly Typed IDs

Open
#329 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Bug
Dominant language
C#
Stars
199
Forks
37
PR merge metrics
No merged PRs in 30d

Description

The problem I've found is that sometimes you need to use optional/nullable foreign keys. When you do this EF Core doesn't like trying to use nullable structs for FKs. The only way I could find to fix this is to change from a record struct to record.

Should probably create a ticket to further investigte this and update the rule if necesary.

See usages of TeamId for more details.

If needed update the rule - https://www.ssw.com.au/rules/do-you-use-strongly-typed-ids/

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the TeamId usages referenced in the issue, focusing on nullable foreign-key scenarios and the difference between record struct and record. Determine whether the strongly typed ID rule needs changing, then update the linked SSW rule if the investigation confirms it.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.