11+ Year IT Industry Experience, Working as Technical Lead with Capgemini | Consultant | Leadership and Corporate Trainer | Motivational and Technical Speaker | Career Coach | Author | MVP | Founder Of RVS Group | Trained more than 4000+ IT professionals | Azure | DevOps | ASP.NET | C# | MVC | WEB API | ANGULAR | TYPESCRIPT | MEAN | SQL | SSRS | WEB SERVICE | WCF... https://bikeshsrivastava.blogspot.in/ http://bikeshsrivastava.com/

The Power of MVC With ASP.NET

Recently I've been delving into the wonderful world of MVC. MVC for the uninitiated stands for Model –View-Controller and is a modern design pattern in software design. To say that this pattern architecture - specifically, Microsoft ASP.NET version 3 - is a vast improvement to how we code over traditional .NET Webforms, does the implementation a huge disservice. The design, while not enforcing proper separation of concerns, very loudly suggests it at every opportunity. I simply feel unclean at the thought of putting controller code into my model classes. It really does that to you.
Power Of MVC

The first thing I noticed about MVC that did take some getting used to was relearning my understanding of how web pages work back in the pre-.NET days. It was a shock to me how much I had forgotten about how Forms worked after dealing with the ‘magical’ implementation seen in Webforms with its Viewstate and Page life cycles. Here’s a basic rundown on how it works:
MODELS: This is the part that is most familiar to me. Models are simply classes with the purpose of storing data for display on Views and passing to the Controller. They enforce the public-facing structure and integrity (including validation if you like) of the site structure.
VIEWS: Bundled with MVC 3 is the view engine called Razor. You can swap in and out other view engines however they are beyond the scope of this discussion; plus, I’ve come to really enjoy working with Razor. At first glance it looked like “Classic” ASP to my eyes – and that’s not a compliment – but I soon saw the advantages of having some (basic) page logic directly in the HTML of a page e.g. loops. Views are similar to regular .NET front-end pages and can be used similarly as MasterPages or UserControls (a Partial View).
CONROLLER: The real work now happens in Controllers. Before you would have a ‘code behind’ on a page where the page logic would go, or a separate class entirely. A controller lets you expose methods that are called by the Views by GET, POST etc. With each return type from your Controller method being a generic ActionResult, it can be cast simply into modern outputs like Json.
So put simply, Views contains your forms which post Models to your Controllers.
Microsoft has become very friendly with the JQuery library, so much so that it is now bundled with MVC ASP.NET. I absolutely love how painless it is to interface a Jquery AJAX post from your View with a method in your Controller, and return the Action Result as a JSON object. It’s highly integrated as to become second nature. You’ll want to AJAX-ify everything, and unlike the old Webforms AJAX Panels, this isn’t a bad thing at all!
Bundling all of the above with other fairly recent Microsoft technologies like LINQ and the Entity Framework allows the creation of faster applications with cleaner and easily testable code. I can’t wait to keep learning more MVC. 
You have just read an article that categorized by title by title The Power of MVC With ASP.NET. You can bookmark this page with a URL https://bikeshsrivastava.blogspot.com/2016/08/the-power-of-mvc-with-aspnet.html. Thank You!
Author: Bikesh Srivastava - Monday, August 29, 2016

4 comments to "The Power of MVC With ASP.NET"

  1. ASP dotNET Web hosting is a form of web hosting that is developed on.net platform, which happens to be one of the premier programming interfaces in the technological cosmos.

    Hire ASP.Net MVC developer in India

    ReplyDelete
  2. Many programmers felt that the ASP.NET framework tried to impose a windows style programming onto the web.

    Hire ASP.Net MVC developer in India

    ReplyDelete
  3. Very Interesting Blog. Thanks for sharing.
    MVC developer

    ReplyDelete

Life Is Complicated, But Now programmer Can Keep It Simple.