What is an MVC framework and why is it necessary/useful?

前端 未结 9 881
自闭症患者
自闭症患者 2021-02-02 03:01

I know that an MVC framework allows you to separate business logic, data base access and presentation, but why do we need a framework to do this.

Can\'t we just keep ou

9条回答
  •  面向向阳花
    2021-02-02 03:20

    MVC stands for “MODEL” “VIEW” “CONTROLLER”. ASP.NET MVC is an architecture to develop ASP.NET web applications in a different manner than the traditional ASP.NET web development. Web applications developed with ASP.NET MVC are even more SEO (Search Engine) friendly. Developing ASP.NET MVC application requires Microsoft .NET Framework 3.5 or higher.

    Model:

    • MVC model is basically a C# or VB.NET class.
    • A model is accessible by both controller and view.
    • A model can be used to pass data from Controller to view.
    • A view can use model to display data in page.

    View:

    • View is an ASPX page without having a code behind file.
    • All page specific HTML generation and formatting can be done inside view.
    • One can use Inline code (server tags ) to develop dynamic pages.
    • A request to view (ASPX page) can be made only from a controller’s action method

    Controller:

    • Controller is basically a C# or VB.NET class which inherits system.mvc.controller.
    • Controller is a heart of the entire MVC architecture.
    • Inside Controller’s class action methods can be implemented which are responsible for responding to browser OR calling views.
    • Controller can access and use model class to pass data to views
    • Controller uses ViewData to pass any data to view.

    MVC Basic Architecture

提交回复
热议问题