Skip to content

Entities

Mehmet Özkaya edited this page Mar 24, 2019 · 1 revision

Includes Entity Framework Core Entities which creates sql table with Entity Framework Core Code First Aproach. Some Aggregate folders holds entity and aggregates. You can see example of code-first Entity definition as below;

public class Product : BaseEntity { public string ProductName { get; set; } public string QuantityPerUnit { get; set; } public decimal? UnitPrice { get; set; } public short? UnitsInStock { get; set; } public short? UnitsOnOrder { get; set; } public short? ReorderLevel { get; set; } public bool Discontinued { get; set; } public int CategoryId { get; set; } public Category Category { get; set; } public static Product Create(int productId, int categoryId, string name, decimal? unitPrice = null, short? unitsInStock = null, short? unitsOnOrder = null, short? reorderLevel = null, bool discontinued = false) { var product = new Product { Id = productId, CategoryId = categoryId, ProductName = name, UnitPrice = unitPrice, UnitsInStock = unitsInStock, UnitsOnOrder = unitsOnOrder, ReorderLevel = reorderLevel, Discontinued = discontinued }; return product; } }

Applying domain driven approach, Product class responsible to create Product instance.

Clone this wiki locally