Skip to content

refactor: implement StronglyTypedId for entity identifiers #98

@mcj-coder

Description

@mcj-coder

Summary

Refactor existing entity identifier types to use the StronglyTypedId source generator library instead of manual implementations.

Library

https://github.com/andrewlock/StronglyTypedId

Current State

Currently using manual readonly record struct implementations for IDs like CharacterId.

Proposed Changes

  • Add StronglyTypedId NuGet package
  • Refactor CharacterId to use [StronglyTypedId] attribute
  • Apply same pattern to any future entity IDs
  • Remove manual ID boilerplate code

Benefits

  • Less boilerplate code
  • Consistent ID handling patterns
  • Built-in JSON/EF Core converters
  • Compile-time type safety

Affected Types

  • CharacterId - currently manual implementation in src/FantasyRpgWorld.Core/Domain/ValueObjects/CharacterId.cs
  • Any future entity identifiers

Acceptance Criteria

  • StronglyTypedId package added
  • CharacterId refactored to use attribute
  • All tests continue to pass
  • Documentation updated if needed

Labels

type:refactor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions