Home > .NET, ASP .NET, JavaScript, Programming, Web Development > Model View Controller in ASP.NET MVC

Model View Controller in ASP.NET MVC

MVC is design pattern that splits the application based on functional responsibility. ASP.NET MVC provides separation of concerns within application like separating data access logic and business logic from UI, in other words we can say it provides a clear separation between Models, Views and Controllers. Also with the ASP.NET framework’s best part is loose coupling it provides between Models, Views and Controllers. This enables the application developer to develop more maintainable, testable effective applications. Separation of concerns is a computer science principle that promotes separating the responsibility for an application. So let’s try to define the Model, View and Controller formally.

Models:

Models are classes that contains data, in other words classes that representing domain entities. Model deal with data attributes (properties), business logic, behaviors and validation. These can be entity framework generated entities, collection, generics or even generic collections too.

Models can be break down into several different layers like:

1. Object layer

The layer contains simple and complex objects which are specify strongly typed view. These objects are used to pass data to and from between controller and view. Also objects can have specific validation rules. So basically these classes contains those properties which will display on view.

2. Data Access Layer (DAL)

This layer provide objects to access and manipulate database of application. Normally these layer made using Entity Framework.

3. Business Layer

The layer which cover business logic and validation of application. The layer directly invoked by Controller for processing and send back to view.

Controllers:

Controllers are classes that facilitate interaction between models and views. Mainly, controllers will get invoke by routers on any user interaction or action and then the action method of the controller will get called. For user’s every action there will be an action method.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: