Rough Cuts are manuscripts that are developed but not yet published, available through Safari. Rough Cuts provide you access to the very latest information on a given topic and offer you the opportunity to interact with the author to influence the final publication.
This is a working draft of a pre-release book. It is available before the published date as part of the Rough Cuts service.
In this book, world-renowned ASP.NET expert and member of the Microsoft ASP.NET team Stephen Walther shows experienced developers how to use Microsoft’s new ASP.NET MVC Framework to build web applications that are more powerful, flexible, testable, manageable, scalable, and extensible.
Writing for professional programmers, Walther explains the crucial concepts that make the Model-View-Controller (MVC) development paradigm work so well and shows exactly how to apply them with the ASP.NET MVC Framework. From controllers and actions to views and models, Walther demonstrates how to apply each ASP.NET MVC Framework feature in real-world projects.
In Part II, you’ll walk step-by-step through building a full-fledged ASP.NET MVC blog application that implements capabilities ranging from data access to validation. Through this case study, you’ll learn how to build ASP.NET MVC applications using test-driven development processes that enable rapid feedback, greater productivity, and better quality.
Throughout, Walther presents extensive code examples, reflecting his unsurpassed experience as an ASP.NET instructor, a leading commercial developer, and now as a member of Microsoft’s ASP.NET development team.
Understand how to:
Introduction 1
How This Book Is Organized 1
What You Should Know Before Reading This Book 2
What Software Do You Need? 2
Where Do You Download the Code Samples? 3
If You Like This Book 3
Part I Building ASP.NET MVC Applications
Chapter 1 An Introduction to ASP.NET MVC 7
A Story with a Moral 7
What Is Good Software? 8
Avoiding Code Smells 9
Software Design Principles 10
Software Design Patterns 11
Writing Unit Tests for Your Code 12
Test-Driven Development 13
Short-Term Pain, Long-Term Gain 14
What Is ASP.NET MVC? 14
ASP.NET MVC Is Part of the ASP.NET Framework 14
The Origins of MVC 15
The Architecture of an ASP.NET MVC Application 16
Understanding the Sample ASP.NET MVC Application 17
ASP.NET MVC Folder Conventions 19
Running the Sample ASP.NET MVC Application 19
Chapter 2 Building a Simple ASP.NET MVC Application 23
Starting with a Blank Slate 23
Creating the Database 25
Creating the Model 27
Creating the Controller 30
Creating the Views 37
Adding the Index View 38
Adding the Create View 42
Chapter 3 Understanding Controllers and Actions 47
Creating a Controller 47
Returning Action Results 51
Returning a View Result 52
Returning a Redirect Result 55
Returning a Content Result 57
Returning a JSON Result 59
Returning a File Result 63
Controlling How Actions Are Invoked 65
Using AcceptVerbs 65
Using ActionName 70
Using ActionMethodSelector 72
Handling Unknown Actions 76
