C#C
C#3y ago
M B V R K

❔ Best Approach to deal with DDD Entities and EF Core Entities

Lets say I want towork on a project using DDD (Domain Driven Design) and EF Core, as you know by following one of the DDD rules, the project should contains a Domain layer which contains the domain Entities... ,

Lets say in the Domain layer I have these entities :
public class Product : Entity
{
  public string Title { get; set; }
  public decimal Price { get; set; }

  // Constructoor and other behaviours
}


public class Order : Entity
{
  public int ProductId { get; set; }
  public byte Quantitiy { get; set }
  public Decimal Total { get; set; }
  
  public Product Product {get; set; }
  
  // Constructoor and other behaviours
}

From your experience, what is the best approach or implementation to let the two DDD's Entities and EF Core's Entities meet?
Was this page helpful?