What is the right architecture for MVC4 WebAPI?

I conducted several searches, but did not find the answer to this question.

Ok, my MVC 3 architecture looks like this:

- Project.EDM (contains only the entity framework edmx file and its .tt and .cs entity classes)
- Project.DAL (contains IXxxRepositiory and XxxRepository where CRUD is performed on the entity classes)
- Project.Web (the MVC3 project. Controllers transfer data from ViewModels into entity models and call the CRUD functions in the DAL repositories.)

WebApiIt MVC4looks so attractive that we can call CRUD operations from other applications. We all love this idea.

But existing examples that I found have CRUD operations inside MVC4's project ApiController. I am used to investing these operations in a separate DAL project. What is the recommended choice? Can we still have a separate DAL class? How do you design architecture?

Thank you for the helpful tips.

+5
source share
1 answer

What am I doing:

  • Repository for querying a database
      • -
      • -

, , API , , , .

, ApiController, , .

+7

All Articles