Get up and running with ASP.NET MVC 4, and learn how to build modern server-side web applications. This guide helps you understand how the framework performs, and shows you how to use various features to solve many real-world development scenarios you’re likely to face. In the process, you’ll learn how to work with HTML, JavaScript, the Entity Framework, and other web technologies.
You’ll start by learning core concepts such as the Model-View-Controller architectural pattern, and then work your way toward advanced topics. The authors demonstrate ASP.NET MVC 4 best practices and techniques by building a sample online auction site (“EBuy”) throughout the book.
- Learn the similarities between ASP.NET MVC 4 and Web Forms
- Use Entity Framework to create and maintain an application database
- Create rich web applications, using jQuery for client-side development
- Incorporate AJAX techniques into your web applications
- Learn how to create and expose ASP.NET Web API services
- Deliver a rich and consistent experience for mobile devices
- Apply techniques for error handling, automated testing, and build automation
- Use various options to deploy your ASP.NET MVC 4 application
Table of Contents
-
Up and Running
-
Chapter 1 Fundamentals of ASP.NET MVC
- Microsoft’s Web Development Platforms
- The Model-View-Controller Architecture
- What’s New in ASP.NET MVC 4?
- Introduction to EBuy
- Installing ASP.NET MVC
- Creating an ASP.NET MVC Application
- Routing
- Controllers
- Views
- Models
- Putting It All Together
- Authentication
- Summary
-
Chapter 2 ASP.NET MVC for Web Forms Developers
- It’s All Just ASP.NET
- More Differences than Similarities
- Authoring ASP.NET MVC Views Using Web Forms Syntax
- Summary
-
Chapter 3 Working with Data
- Building a Form
- Handling Form Posts
- Saving Data to a Database
- Validating Data
- Summary
-
Chapter 4 Client-Side Development
- Working with JavaScript
- Selectors
- Responding to Events
- DOM Manipulation
- AJAX
- Client-Side Validation
- Summary
-
Going to the Next Level
-
Chapter 5 Web Application Architecture
- The Model-View-Controller Pattern
- Architecting a Web Application
- Design Principles
- Don’t Repeat Yourself
- Summary
-
Chapter 6 Enhancing Your Site with AJAX
- Partial Rendering
- JavaScript Rendering
- Reusing Logic Across AJAX and Non-AJAX Requests
- Sending Data to the Server
- Cross-Domain AJAX
- Summary
-
Chapter 7 The ASP.NET Web API
- Building a Data Service
- Paging and Querying Data
- Exception Handling
- Media Formatters
- Summary
-
Chapter 8 Advanced Data
- Data Access Patterns
- Entity Framework Overview
- Building a Data Access Layer
- Sorting, Filtering, and Paging Data
- Summary
-
Chapter 9 Security
- Building Secure Web Applications
- Securing an Application
- Guarding Against Attacks
- Summary
-
Chapter 10 Mobile Web Development
- ASP.NET MVC 4 Mobile Features
- Making Your Application Mobile Friendly
- Improving Mobile Experience
- Adaptive Rendering
- Creating a New Mobile Application from Scratch
- Summary
-
Going Above and Beyond
-
Chapter 11 Parallel, Asynchronous, and Real-Time Data Operations
- Asynchronous Controllers
- Real-Time Asynchronous Communication
- Summary
-
Chapter 12 Caching
- Types of Caching
- Server-Side Caching Techniques
- Client-Side Caching Techniques
- Summary
-
Chapter 13 Client-Side Optimization Techniques
- Anatomy of a Page
- Best Practices
- Measuring Client-Side Performance
- Putting ASP.NET MVC to Work
- Summary
-
Chapter 14 Advanced Routing
- Wayfinding
- URLs and SEO
- Building Routes
- Route Constraints
- Attribute-Based Routing
- Extending Routing
- Summary
-
Chapter 15 Reusable UI Components
- What ASP.NET MVC Offers out of the Box
- Taking It a Step Further
- Unit Testing Razor Views
- Summary
-
Quality Control
-
Chapter 16 Logging
- Error Handling in ASP.NET MVC
- Logging and Tracing
- Summary
-
Chapter 17 Automated Testing
- The Semantics of Testing
- Levels of Automated Testing
- What Is an Automated Test Project?
- Testing an ASP.NET MVC Application
- Code Coverage
- Developing Testable Code
- Summary
-
Chapter 18 Build Automation
- Creating Build Scripts
- Automating the Build
- Continuous Integration
- Summary
-
Going Live
-
Chapter 19 Deployment
- What Needs to Be Deployed
- Deploying to Internet Information Server
- Deploying to Windows Azure
- Summary
-
Appendixes
-
Appendix ASP.NET MVC and Web Forms Integration
- Choosing Between ASP.NET MVC and ASP.NET Web Forms
- Transitioning a Web Forms Site to ASP.NET MVC
- Integrating Web Forms and ASP.NET MVC Functionality
- Summary
-
Appendix Leveraging NuGet as a Platform
- Installing the NuGet Command-Line Tool
- Creating NuGet Packages
- The Anatomy of a NuGet Package
- Types of NuGet Packages
- Tool Packages
- Sharing Your NuGet Packages
- Tips, Tricks, and Pitfalls
- Summary
-
Appendix Best Practices
- Use the NuGet Package Manager to Manage Dependencies
- Depend on Abstractions
- Avoid the New Keyword
- Avoid Referring to HttpContext Directly (Use HttpContextBase)
- Avoid “Magic Strings”
- Prefer Models over ViewData
- Do Not Write HTML in “Backend” Code
- Do Not Perform Business Logic in Views
- Consolidate Commonly Used View Snippets with Helper Methods
- Prefer Presentation Models over Direct Usage of Business Objects
- Encapsulate if Statements with HTML Helpers in Views
- Prefer Explicit View Names
- Prefer Parameter Objects over Long Lists of Parameters
- Encapsulate Shared/Common Functionality, Logic, and Data with Action Filters or Child Actions (Html.RenderAction)
- Prefer Grouping Actions into Controllers Based on How They Relate to Business Concepts
- Avoid Grouping Actions into Controllers Based on Technical Relation
- Prefer Placing Action Filters at the Highest Appropriate Level
- Prefer Multiple Views (and/or Partial Views) over Complex If-Then-Else Logic That Shows and Hides Sections
- Prefer the Post-Redirect-Get Pattern When Posting Form Data
- Prefer Startup Tasks over Logic Placed in Application_Start (Global.asax)
- Prefer Authorize Attribute over Imperative Security Checks
- Prefer Using the Route Attribute over More Generic Global Routes
- Consider Using an Antiforgery Token to Avoid CSRF Attacks
- Consider Using the AcceptVerbs Attribute to Restrict How Actions May Be Called
- Consider Output Caching
- Consider Removing Unused View Engines
- Consider Custom ActionResults for Unique Scenarios
- Consider Asynchronous Controllers for Controller Tasks That Can Happen in Parallel
-
Appendix Cross-Reference: Targeted Topics, Features, and Scenarios
-
Index
-
Colophon
Nguồn: https://nhasachmienphi.com