In domain design, the domain model must be completely unaware of any persistent data.
Say a Employeebelongs to a Department. Domain objects may look like this:
public Employee
{
public string EmployeeId { get; set; }
public string FirstName { get; set; }
public string LastName{ get; set; }
public Department Department { get; set; }
public int DepartmentId { get; set; }
}
public Department
{
public string DepartmentId { get; set; }
public string Name{ get; set; }
}
Is it Employee.DepartmentIdreally relevant in the domain model or is it an infrastructure storage part?
Surely, Employee.Departmentis this attitude that matters at this level?
In my case, these objects will be stored in the SQL database, and the data will be received by the Entity Framework, so a column will exist in the database Employee.DepartmentId.
source
share