How to use domain-driven design (DDD) correctly?

take an example of adding a user scenario.

first a user object comes from the foreground,

then you need to verify this object,

verify that the user name is in full English letters,

query database, user name does not exist,

, you can insert

.

how should the application layer and domain layer be written in such a scenario? I would like to ask you to give a little more specific code, thank you.

service corresponds to the application layer, calling the entity entity layer and the repository repository,dao layer store.

and how to use value objects.

Mar.10,2021

1. First write the Poco object of User at the domain level, then there is a CreateUser method in the logic of the domain layer User object, pass in the User object, assign the property of the incoming User object to this, and then return this.
2. There are two methods to implement in the warehouse User warehousing. The first method is to query whether the database user exists, and the second method is AddUser,. What we should pay attention to here is that AddUser uses the pre-addition of the data access framework, rather than completing the real persistence.
3. To pass the UserDTO object in the CreateUser method in the application service layer, first check the UserDTO, such as English, then assign the UserDTO attribute to the User object property, then call the check user in the warehouse, then call the CreateUser method in the domain logic, then use the warehouse to call the AddUser method, and finally use the persistence method of the database framework to complete the persistence.
4. A value object can be understood as a domain object with its own properties and methods, and then make the value object a property of the domain object that contains it.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ada9-2c25e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ada9-2c25e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?