Replies: 1 comment
-
Depends on what size and complexity the project is. If your project is relatively small and simple (CRUD application), I wouldn't recommend using this template and creating DDD entities, it's simply not needed. If you are building a large project with a complex business logic, here are some recommendations:
class ProductEntity {
price: number;
name: string;
description: string;
changeDescription(description: string) {
// ...
}
applyDiscount(discount:number) {
// ...
}
Keep in mind that Domain Entities represent the domain business logic, and must be modeled to accommodate the domain. How to model entities and tables totally depends on the project and requires some experience, so keep practicing and it will come eventually. |
Beta Was this translation helpful? Give feedback.
-
I'm trying to figure out how to model my database using entities. For instance, I want to model a 'products' table through a 'Product' entity. How would I go about doing this?
Is it necessary to create the database first before I start coding?
I would really appreciate some guidance on this matter. I'm planning to use this template for projects, but I need to solve this "problem" first.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions