3

I am 1 of 3 developers. The other 2 use Web API and angular to build web apps. I prefer ASP MVC with a repository and EF. The stated argument is that a service is more secure when accessing the database.

I think my way is just as secure if not more so. And I don't want to have to learn Angular. I could use Web API to do the data access, then use an MVC controller to call the data and render my razor views, but that seems a bit like double work. Or would the MVC controler just take the place of having to do all the data binding on the client side?

So;

  1. Is a Web service more secure than a repo in MVC with EF?
  2. Is there any problem with calling data from a Service with an MVC controller so I can avoid having to make tons of ajax calls and data binding on the client side /learn angular?
  • The stated argument is that a service is more secure when accessing the database. -- That's the wrong argument. The correct argument is "which technology is more suitable for building our particular app," which encompasses far more strategic elements than merely security. – Robert Harvey Aug 9 '16 at 21:19
5

Web API and MVC a for all practical purposes the same. A Web API interface is a subclass of an MVC Controller. The only difference is instead of returning a rendered template from a Web API controller, you return JSON or XML. In fact, you can replicate the functionality of Web API using standard MVC controllers (which is what my team did before Web API was available).

There is nothing stopping Web API using EF and the repository pattern for data access.

Using Angular on the front end isn't as challenging as it seems at first. In fact, it helps separate your UI logic from the backend business logic. However, the argument that Angular is somehow inherently more secure than server-side UI rendering is fallacious.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.