Luis Valencia
Luis Valencia

Reputation: 33978

webapicontroller only or both controller and webapi controller

I am designing architecture for one small application, one of the requirements is to have everything exposed as services. I know that with web api controllers thats pretty easy to do.

However I am unsure if I still must have the normal MVC controllers also in the design.

enter image description here

If you have experience in design and architecture, can you please share your thoughts on this?, do you consider this diagram is correct or how should I improve it?

Upvotes: 1

Views: 56

Answers (1)

Pedro Benevides
Pedro Benevides

Reputation: 1980

You could follow this approach:

  • Domain Layer (With your entities, service domain and interfaces)
  • Repository Layer (Data access classes)
  • Service Layer (Web Api project to expose your data, and be consumed)
  • Application Layer (Where you put your ViewModel, and this way you can share between Service Layer(Api) and Web Layer(MVC), and other stuffs like automapper)
  • Presentation Layer (Your MVC project)

Like you said, your application is small, but you could follow some principles of DDD, and always create an application more decoupled, and easy to maintain.

Upvotes: 3

Related Questions