ardalis / pluralsight-ddd-fundamentals

Sample code for the Pluralsight DDD Fundamentals course by Julie Lerman and Steve "ardalis" Smith

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve encapsulation of the entities.

fiseni opened this issue · comments

I took a brief look at the project.
I'd suggest refactoring some of the entities with purely immutable properties (wherever is required). Now that EF can utilize constructors, we can better model our entities.

Also, I noticed almost all entities contain a constructor that accepts only id parameter. This allows the users to create instances in an incorrect states.

public Patient(int id)
{
      Id = id;
}

If you do agree with these sentiments, I may look into this someday soon. A related blog post here, and a sample application here

I updated the important entities (schedule, appointment) in the main bounded context (FrontDesk) to better use constructors. Thanks!