开发者

MVC Architecture

开发者 https://www.devze.com 2023-01-11 03:28 出处:网络
I know similar questions have been posted before, but I have specific requirements that make this as far as I c开发者_高级运维an find unanswered.

I know similar questions have been posted before, but I have specific requirements that make this as far as I c开发者_高级运维an 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!


You should look at ContactManager sample with eight section tutorial on the ASP.NET MVC website, it's implemented with a repository class so data layer is abstracted.

0

精彩评论

暂无评论...
验证码 换一张
取 消