Building a domain object from DTO

Let's look at a typical web application scenario

  • The user clicks the "create TEST application" button, initiating a request for a TEST application form (in this case .aspx)
  • Before loading the TEST form

    and. Service Layer requests a TEST Factory application to create a domain object
    b. Factory initializes application # and other nested objects
    with. Factory returns a domain object
    . The service accepts assembler help to create a DTO and return to the presentation level.

  • The user fills in the data and sends the TEST application form
  • The presentation layer creates the DTO and sends it to the service layer

Questions

  • How should the system build a domain object from dto after the user sends the data for verification?
  • Should we use Factory or allow the collector / collector to build a domain object from the DTO?
  • If we use mapper to create a domain object from dto, it breaks the Factory rule: (
  • If we use Factory again, will not we re-create a new application # for the domain object? rehydrate domain object from DTO using Assembler?
+3
source share
1 answer

How should the system build a domain object from dto after the user sends the data for verification?

Having received it from storage / persistent storage.

Should we use factory or mapper / assembler creates a domain object from DTO?

None.

If we use mapper to build a domain object from dto, then it is interrupted by the factory rule: (

Factory - . factory . ( ) , . . , .

factory # ?

, , factory , .

. :

TEST

. TEST factory

. factory #

. factory

. DTO

, , . . , , ?

+3

Source: https://habr.com/ru/post/1785055/


All Articles