ardalis / ardalis/StatePattern

Mapping the State Pattern to a Database

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
33
Forks
18
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

No file or test is named. Start by reading the Policy class and its private nested State classes, then inspect how the project currently models persistence; the issue would need a decided EF Core mapping approach and corresponding documentation or implementation before completion can be verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.