Skip to main content
added 515 characters in body
Source Link
Ewan
  • 84.4k
  • 5
  • 91
  • 189

It looks like you are missing a service layer between you business logic and your websites.

If you draw in a horizontal slice on your diagram for it you can see immediately that you have a choice of whether to:

  • Move you existing "Services Project" into that layer and have the Website and Mobile Clients both consume it.

  • OR to create a new project comprising of the orchestration of you Business Objects which two slimmed down WebSite/WebAPI projects consume.

I wouldn't have more projects for the adaptors myself, as I would see that as the main role of the WebSite/WebApi after having moved any non view related logic to the service layer.

Is it correct to accept only DTO from the clients and return back only DTO/HTML to them? Is it necessary to convert DTO to entity for each request and vice-versa for each response?

You don't have much choice. You have to serialise the Entity, whatever you serialise it to is the DTO or ViewModel.

Your only question is really how similar the ViewModel/DTO is to the Entity. Usually the ViewModel/DTO simplifies the work of the View/Client by adding fields, flattening data etc as you say. But the simplest way is sometimes just to serialise the Entity as it is.

It looks like you are missing a service layer between you business logic and your websites.

If you draw in a horizontal slice on your diagram for it you can see immediately that you have a choice of whether to:

  • Move you existing "Services Project" into that layer and have the Website and Mobile Clients both consume it.

  • OR to create a new project comprising of the orchestration of you Business Objects which two slimmed down WebSite/WebAPI projects consume.

I wouldn't have more projects for the adaptors myself, as I would see that as the main role of the WebSite/WebApi after having moved any non view related logic to the service layer.

It looks like you are missing a service layer between you business logic and your websites.

If you draw in a horizontal slice on your diagram for it you can see immediately that you have a choice of whether to:

  • Move you existing "Services Project" into that layer and have the Website and Mobile Clients both consume it.

  • OR to create a new project comprising of the orchestration of you Business Objects which two slimmed down WebSite/WebAPI projects consume.

I wouldn't have more projects for the adaptors myself, as I would see that as the main role of the WebSite/WebApi after having moved any non view related logic to the service layer.

Is it correct to accept only DTO from the clients and return back only DTO/HTML to them? Is it necessary to convert DTO to entity for each request and vice-versa for each response?

You don't have much choice. You have to serialise the Entity, whatever you serialise it to is the DTO or ViewModel.

Your only question is really how similar the ViewModel/DTO is to the Entity. Usually the ViewModel/DTO simplifies the work of the View/Client by adding fields, flattening data etc as you say. But the simplest way is sometimes just to serialise the Entity as it is.

Source Link
Ewan
  • 84.4k
  • 5
  • 91
  • 189

It looks like you are missing a service layer between you business logic and your websites.

If you draw in a horizontal slice on your diagram for it you can see immediately that you have a choice of whether to:

  • Move you existing "Services Project" into that layer and have the Website and Mobile Clients both consume it.

  • OR to create a new project comprising of the orchestration of you Business Objects which two slimmed down WebSite/WebAPI projects consume.

I wouldn't have more projects for the adaptors myself, as I would see that as the main role of the WebSite/WebApi after having moved any non view related logic to the service layer.