Best practices while using ASP.Net MVC

  • Create a separate assembly for MODEL in case of large and complex code to avoid any unwanted situation o
  • The model should include business logic, session maintenance, validation part, and data logic part.
  • VIEW should not contain any business logic and session maintenance, use ViewData to access data in View
  • Business logic and data access should never occur in ControllerViewData
  • The controller should only be responsible for preparing and return a view, calling model, redirect to action, etc.
  • Delete Demo code from the application when you create it Delete AccountController
  • Use only specific view engine to create HTML markup from your view as it is the combination of HTML and the programming code.

Summary

  • ASP.NET MVC is an open source web development framework from Microsoft that provides a Model View Controller architecture.
  • ASP.net MVC offers an alternative to ASP.net web forms for building web applications
  • The main issue with ASP.net webForms is performance.
  • ASP.net MVC offer Easy and frictionless testability with Full control over your HTML & URLs
  • You need to remember that ASP .net MVC is NOT a replacement of ASP.Net web forms based applications
  • The approach of MVC app development must be decided based on the application requirements and features provided by ASP .net MVC to suit the specific development needs.
  • ASP.net MVC offers Highly maintainable applications by default
  • With ASP.net you can't see design page preview like the .aspx page.
  • As a best practise, the model should include business logic, session maintenance, validation part, and data logic part.

Post a Comment

0 Comments