ASP.Net MVC and N-Tier

Greetings

I apologize in advance that I did not investigate it is difficult enough to answer the question myself, but I think it will take me some time, and I would rather know now before investing more time in studying this. I could not find anything in my initial research.

Why use ASP.Net MVC if you are already using a layered architecture (Data Layer, Logic Layer, Presentation Layer)? In addition, the controller has more power than the logic level.

I correctly understood that I can use nHibernate and all my data access classes, entities and mappings in the part of the MVC model?

When using controllers, is it best to separate most of the logic from a separate class so that I can name it from several controllers? Or I can call them from the controllers themselves, given the fact that I would not want all of them to be Actions, just normal methods.

thanks

+4
source share
5 answers

MVC is not a substitute for N-Tier; it is a way to organize the presentation layer.

I would not say that the controller is more powerful than the logic level. Instead, the controller (as part of the presentation layer) must still invoke the logical layer.

Controllers should only prepare data for representations and process actions from representations. You should still use your BLL anyway.

+8
source

Yes, NHibernate objects can (and should be) passed to views.

That you will encounter some trouble. You should use flattened, zero-tolerant DTOs aka view models.

+3
source
+2
source

N-tier is an architectural template to enable reuse, separation of concerns, and scalability of key areas of your application. Non-user interface levels (business, data, facade, etc.) Must be individually tested and incompatible with the user interface.

The user interface layer is just one of these layers; these are Silverlight weather, ASP.NET MVC, web forms, etc.

MVC, such as MVP, is a design pattern that provides better testability of the user interface layer. ASP.Net MVC is a wrapper that supports and applies this pattern. The template was round for use long before this structure.

But this is just a choice of user interface level. The controllers should not have any interaction with databases, services, etc., they control the state of the view using the model, should not control business logic, entity, transactions, etc.

+1
source

To answer your question about why use if you are already going multi-level, is that it makes a more organized and friendly search URL. It is also a more standard template than other templates, typically in ASP.Net. This makes it more convenient for developers for those who already use MVC on other platforms.

0
source

All Articles