Skip to content

Mapping the State Pattern to a Database #2

@samuelmaxton

Description

@samuelmaxton

Hi, I really like this pattern. But I am wondering how this might work with EF Core. The Policy class could easily be an entity that maps to a DB table. But I'm not quite sure how the private nested State classes should be handled? Would they live in-memory or in the DB? I can imagine a State table containing all possible states that would then be included in all Policy queries. But I'm not sure if that breaks this pattern. You are new-ing up the states in the Policy class constructor etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions