简体   繁体   中英

MVC Architecture

I know similar questions have been posted before, but I have specific requirements that make this as far as I can find unanswered.

The project wants to have a typical 3-tier architecture, but they want the data layer to be abstracted by Entity Framework, the presentation layer to be MVC 2 and the application layer to be simple class library.

Do those components (EF and MVC) fit into that architecture.

Note: the project would follow a TDD methodology.

Any help is appreciated.

Absolutely.

Any good demonstration/articles on ASP.NET MVC Web Applications follow this architecture.

Typically your solution would look like this:

YourProject.Model (Class Library with POCO's - domain objects)

YourProject.Repository (Class Library with Entity Framework).

YourProject.Services (Class Library acts as mediator between Repository and Controllers)

YourProject.MVC (MVC2 Web Application)

YourProject.Tests (Unit Test Project - typically 1 project per tier)

To answer your questions, the Repository abstracts the data from the other modules, the presentation layer is MVC2, and the application layer could be built into the Services module, or have another module altogether.

Of course MVC fits beautifully with TDD, you can mock your controllers and test the class library just like you would test any class library.

Check out Rob Conery's MVC Storefront series on www.asp.net - best video series ive ever seen.

Good luck!

您应该在 ASP.NET MVC 网站上查看带有八节教程的 ContactManager 示例,它是使用存储库类实现的,因此数据层是抽象的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM