Hands on With
ASP.NET
MVC
Hands on With
ASP.NET MVC
Rahul Sahay
Quills Ink Publishing
Copyright 2014 Rahul Sahay
Hardcover ISBN : 978-93-84318-52-9
Softcover ISBN : 978-93-84318-53-6
Ebook ISBN : 978-93-84318-54-3
Design and Setting By
Quills Ink Publishing
www.quillsink.com
All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher.
The views and characters expressed in the book are of the author and his/her imagination and do not represent the views of the Publisher.
Contents
Introduction
Hands-on with ASP.NET MVC book give you a fine Launchpad to get started on MVC. I have written the book in such a fashion that you will solve one case study while studying the book. By the time you will finish the book, you would have completed web version and mobile version of development using MVC. Now, one important point to understand here that ASP.NET MVC is a major shift for all Microsoft developers. ASP.NET MVC emphasizes clean architecture, design patterns and testability. At every part of the book you will get practical example of all the theoretical concepts with complete demo.
ASP.NET MVC is basically a web development framework from Microsoft which combines the features of MVC (Model-View-Controller) architecture. Now, ASP.NET MVC is not something which is built from the ground zero. It built on the top of ASP.NET, so developers enjoy almost all the ASP.NET features while building the MVC application. ASP.NET MVC is an alternative approach to an existing Web Forms approach.
This book is basically comprised of 15 chapters covering all the parts of MVC development. 1st chapter starts with the introduction of ASP.NET MVC where in you will see how MVC gained maturity in different releases. 1st chapter will also showcase that what you are going to build by giving the application glimpse in its finished form. Then, you will start creating your MVC project right from the scratch. In 2nd Chapter you will get the complete idea of controllers. Here, after understanding the basics of controllers, you will be writing your 1st controller. 2nd chapter also covers different types of action results, filters and many more things. 3rd chapter will have view introduction with syntactic sugar. This section also explains some of the core concepts of data (dash) attributes that how views behind the scenes emit these tags. Apart from HTML helpers, you will also work with different types of view in it. Chapter 4 and 5 will be all about data modeling. In this chapter you will come to know how to get started with entity framework, also how to setup the entities and migrations. Here you will also see different types of validations in action.
Chapter 6 is all about Client side scripts. Its main focus would be on how to manage scripts, how to work with Ajax helpers and how to write an Async Search. Chapter 7 is covering all the security related features like Membership, Authentication, Roles, Open Authentication and many more things. Now, chapter 8 is all about infrastructure topic like Caching and different Diagnostics techniques. This topic stresses how to improve the Application performance by implementing caching. 9th chapter is all about testing. It start with unit testing where in you can test your application logic, then web testing and load testing where in you can test your website performance in different test scenarios. Then we have 10th chapter which is all about deployment. In this case you will 1st deploy the application to IIS, then on internet on AZURE. Chapter 11 is all about routing concepts. This chapter deals with different routing rules. Then, chapter 12 comprise of Web API and Dependency Injection. Both of these topics are really important and interesting as well. You will learn how to implement both with a complete application demo. In chapter 13, you will be optimizing your application in such a way that it will support mobile browsers as well. Then, Chapter 14 is dedicated to the new features of ASP.NET MVC 5 with complete demo. Last but not the least which is the bonus part of this book MVC 6; here, in chapter 15 you will start from the features discussion, then prerequisites required for MVC 6. MVC 6 is a major breakthrough from Microsoft side towards being Open Source Compliant. So, stay tuned for a stunning journey.
Acknowledgments
This book would not have been possible without the patient and loving support of my wife Nivi, who had to take over much of the household responsibility apart from her teaching activities, so I could whisper to myself in the corner and do my activities with my laptop. Many thanks also go to my publisher, Rohan Vij, who took this responsibility, to publish the book in a precise and correct way.
Appreciation also goes out to my Mom and Dad for believing in me and always keeps on encouraging me to complete the book in a best possible way. Also, I need to acknowledge you, the reader, for your desire to continue your own growth not only as developer but a smart developer. Obviously, your efforts to improve your skills make me all work to improve myself to keep up the good work. Kudos to you, and keep setting the pace at your workplace!
I would also like to Thank Sanjay for writing the FOREWORD for me. He took his time from his day to day busy schedule, read the complete book; gave his suggestions for improvement and finally after implementing his suggestions he wrote foreword for me.
WHO SHOULD TAKE THIS BOOK
Hand-on with ASP.Net MVC is designed to teach ASP.NET MVC, from grass root level to advanced topics. I have written the book in such a way that even if you are new to ASP.Net background, you won't feel difficulty in understanding the concepts.
I also understand that many of our readers are familiar with ASP.NET Web Forms, so one important point to understand here that ASP.Net MVC is not a replacement to Web Forms at all. Now, onwards there will be one more design technique to build websites.
I have worked hard to make sure that this book is valuable for developers who are experienced with ASP.NET MVC, or even freshers coming out of college. This book is also very well suited to 3rd year and Final year student as this will help them greatly while building their projects. Also, since ASP.NET MVC is one of the hottest trends across industry, so from the point of interview preparation as well, it will be a good reference book. Now, apart from MVC you will also learn how to convert the same app to support mobile browsers, also how to host the app on Azure (Microsoft's Cloud Version).
Foreword
Today I am really thrilled to introduce this book covering the latest release of ASP.NET MVC, written by one my friend Rahul Sahay.
Rahul was developer when I interacted with him for the first time. He is tech extrovert and interacting with wide variety of technology to gain knowledge, guideline and feedback. His interactions with the diverse ASP.NET community give him some great insights on how developers can begin, learn, and master ASP.NET MVC. He is helping number of blog followers on various topics which is known to him and generated a lot of fans and followers with his technical skills. With a background rooted in community and open source, I count him not only as an amazing technologist but also a close friend.
There are number of frameworks available in market but ASP.NET MVC 6 brings you a new ASP.NET Web API (a new framework for building HTTP services), updated default project templates that leverage modern web standards, solid mobile web application support, enhanced support for asynchronous methods, and more with easy integration with other microsoft technology. Currently, MVC 6 is in beta version, which will be officially releasing next year. But, Rahul took this opportunity to include MVC 6 as well in this book. Before touching MVC 6, he has also covered MVC 5 and 4 with complete detail with live demo.
Next page