logo资料库

asp-net-core-application-development(英文版).pdf

第1页 / 共829页
第2页 / 共829页
第3页 / 共829页
第4页 / 共829页
第5页 / 共829页
第6页 / 共829页
第7页 / 共829页
第8页 / 共829页
资料共829页,剩余部分请下载后查看
Title Page
Copyright Page
Dedication Page
Contents at a Glance
Table of Contents
Introduction
Who should read this book
Assumptions
This book might not be for you if...
Organization of this book
Finding your best starting point in this book
Conventions and features in this book
System requirements
Downloads: Sample Project
Errata, updates, & book support
Free ebooks from Microsoft Press
We want to hear from you
Stay in touch
Part 1: Alpine Ski House
Chapter 1. How We Got Here
Active Server Pages
ASP.NET
ASP.NET MVC
Web API
ASP.NET Core
Summary
Chapter 2. Influencers
Backward compatibility
Rails
Node.js
Angular and React
Open source
OWIN
Summary
Chapter 3. Models, Views, and Controllers
The M, the V, and the C of it
Diving into Models
Views
Partial Views
Controllers (...and Actions!)
It’s Not Just About MVC
Middleware
Dependency Injection
Other Gems
Summary
Chapter 4. Scoping the Project
Ski Slopes
The API
The Admin View
Pulling the Pieces Together
Defining our Domain
Summary
Chapter 5. Builds
Command Line Builds
Build Servers
The Build Pipeline
Building Alpine Ski House
Summary
Chapter 6. Deployment
Picking a web server
Kestrel
Reverse Proxy
IIS
Nginx
Publishing
Build Types
Building A Package
The Case for Azure
Azure Deployments
Container Deployments
Summary
Part 2: Sprint Retro: A Journey of 1000 Steps
Chapter 7. Building Web Applications with Microsoft Azure
Thinking of Platform as a Service
Platform Services
Scaffolding, Destroying, and Recreating Your Services
Building Applications Using Platform Services
Creating a Storage Account
Storing Images in Blob Containers
Incorporating Storage Queues
Automating Processing with Azure WebJobs
Scaling Out Your Applications
Scaling in Multiple Directions
Scaling with Elasticity
Scaling Considerations
Summary
Chapter 8. Cross-Platform
Up and Running on Ubuntu
Installing .NET Core
The dotnet CLI
Choosing a Code Editor
Alpine Ski House on Linux
.NET Core
Summary
Chapter 9. Containers
Repeatable Environments
Docker
Windows Containers
Docker in Production
On the Cloud
Summary
Chapter 10. Entity Framework Core
Entity Framework Basics
Querying for a single record
Querying for multiple records
Saving Data
Change Tracking
Using Migrations to Create and Update Databases
The ApplicationDbContext
Extending ApplicationUserContext
Ski Card Context
Relationships crossing Context Boundaries
Wiring up the Controller
Pass Types
Passes and Validation
Events and Event Handlers
Summary
Chapter 11. Razor Views
Creating Web Sites as a Developer Today
Building on Previous Successes and Learnings
Understanding Razor’s Role
Mastering Razor Essentials
Peeking Behind the Curtain
Writing Expressions with Razor Syntax
Switching to Code
Explicitly Using Markup
Razor Parser Control Cheat Sheet
Bringing in More C# Features
Using C# Types in Your Views
Defining a Model
Using View Data
Working with Layouts
Foundations of Layouts
Including Sections from Views
Defining and Consuming Partial Views
Enhancing Views with Advanced Razor Functionality
Injecting Services into a View
Working with Tag Helpers
Avoiding Duplication in Your Views
Using Alternate View Engines
Summary
Chapter 12. Configuration and Logging
Moving Away from web.config
Configuring Your Application
Using Stock Configuration Providers
Building a Custom Configuration Provider
Employing the Options Pattern
Logging as a First-Class Citizen
Creating Logs That Provide Clarity
Setting Expectations for Exceptions
Logging as a Development Strategy
Logging Levels in ASP.NET Core
Using Logging Scopes to Augment Logging
Using a Structured Logging Framework
Logging as a Service
Summary
Part 3: Sprint Retro: The Belly of the Beast
Chapter 13. Identity, Security, and Rights Management
Defense in Depth
Internal Threats
External Threats
User Secrets
Azure-Backed Authentication
Identity in ASP.NET Core MVC
Referencing ASP.NET Identity
Local User Accounts
Other Third-Party Authentication Providers
Enabling Security Through Attributes
Using Policies for Authorization
Applying Policies Globally
Defining Policies for Selected Use
Custom Authorization Policies
Protecting Resources
Cross-Origin Resource Sharing (CORS)
Summary
Chapter 14. Dependency Injection
What is Dependency Injection?
Resolving Dependencies Manually
Using a Service Container to Resolve Dependencies
Dependency Injection in ASP.NET Core
Using The Built-In Container
Using a third-party container
Summary
Chapter 15. Role of JavaScript
Writing Good JavaScript
Do We Even Need it?
Organization
To SPA or not to SPA?
Building JavaScript
Bundler & Minifier
Grunt
gulp
WebPack
Which Tool is Right for me?
TypeScript
ES2015 to ES5 Compiler
Typing System
Module Loading
Picking a Framework
Summary
Chapter 16. Dependency Management
NuGet
Installing packages with NuGet
npm
Adding Dependencies
Using npm modules
Visual Studio Integration
Yarn
Bower
Adding Dependencies
Referencing Assets from Bower Packages
Summary
Chapter 17. Front End with Style
Building Websites with Style Sheets
Digging up the Past
Creating Your Own Style Sheet
Getting Sassy with Your Style
Basics of SCSS
Creating Mixins
Mixing Mixins and Directives
Establishing a Development Workflow
Using Command Line Tools
Working in Visual Studio Code
Modifying the Project Build Tasks
Using Third Party Frameworks
Extending a CSS Framework
Customizing a CSS Framework Footprint
Leveraging CSS Frameworks for Custom Style Sheets
Alternatives to CSS Frameworks
Summary
Chapter 18. Caching
Cache Control Headers
Using the Data-Cache
In Memory Cache
Distributed Cache
How Much Cache is Too Much?
Summary
Part 4: Sprint Retro: Home Stretch
Chapter 19. Reusable Components
Tag Helpers
Anatomy of a Tag Helper
Scripts, Links, and Environment Tag Helpers
Cache Tag Helper
Creating Tag Helpers
View Components
Invoking View Components
Contact Customer Service View Component
Partial Views
Summary
Chapter 20. Testing
Unit Testing
XUnit
JavaScript Testing
Other Types of Testing
Summary
Chapter 21. Extensibility
Conventions
Creating Custom Conventions
Middleware
Configuring the pipeline
Writing your own Middleware
Pipeline Branching
Loading External Controller and Views
Loading Views from External Projects
Loading Controllers from External Assemblies
Routing
Attribute Routing
Advanced Routing
Dotnet tools
JavaScript Services and Isomorphic Applications
Isomorphic Applications
Node Services
Summary
Chapter 22. Internationalization
Localizable Text
String Localization
View Localization
Data Annotations
Sharing Resource Files
Setting the Current Culture
Summary
Chapter 23. Refactoring and Improving Code Quality
What is refactoring?
Measuring Quality
Finding Time to Refactor
Refactoring with a Safety Net
Data Driven Changes
A Code Cleanup Example
Tools That Want to Help
Getting to Quality
Summary
Chapter 24. Organizing the Code
Repository Structure
Inside the Source
Parallel Structure
MediatR
A Brief Introduction to the Messaging Pattern
Implementing a Mediator
Areas
Summary
Postfix
Index
About the Authors
Hear about it first
Visit us today
Free ebooks
Survey
Code Snippets
ASP.NET Core Application Development: Building an application in four sprints (Developer Reference) James Chambers David Paquette Simon Timms
PUBLISHED BY Microsoft Press A division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 2017 by James Chambers, David Paquette & Simon Timms All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Library of Congress Control Number: 2016958907 ISBN: 978-1-5093-0406-6 Printed and bound in the United States of America. First Printing Microsoft Press books are available through booksellers and distributors worldwide. If you need support related to this book, email Microsoft Press Support at mspinput@microsoft.com. Please tell us what you think of this book at http://aka.ms/tellpress. This book is provided “as-is” and expresses the author’s views and opinions. The views, opinions and information expressed in this book, including URL and other Internet website references, may change without notice. Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred. Microsoft and the trademarks listed at http://www.microsoft.com on the “Trademarks” webpage are trademarks of the Microsoft group of companies. All other marks are property of their respective owners. Acquisitions Editor: Laura Norman Developmental Editor: Troy Mott Editorial Production: Ellie Volckhausen Technical Reviewer: Rachel Appel Copyeditor: Rachel Jozsa Indexer: Julie Grady Cover: Chuti Prasertsith
I would like to dedicate this book to my loving wife. Thank you for your support and I look forward to spending more time outdoors with you once I finally emerge from this office. —DAVID PAQUETTE I would like to dedicate this book to my children who have been forced to play without me while I work feverishly pressing buttons in front of a glowing box and my wife who taught them to sing Cat’s In The Cradle outside my office door. Without their support I would be but a quarter of a person. I love them more than I have words to express. —SIMON TIMMS I dedicate this book to my incredible, intelligent and striking wife who has supported me for over twenty years while I chase dreams and sometimes our pet dog who gets out in the middle of the night. I dedicate it to my children that I love endlessly and completely. I can’t wait to spend more time with them, even if they need more showers and should ask for rides less. —JAMES CHAMBERS
Contents at a Glance Introduction PART 1 ALPINE SKI HOUSE HOW WE GOT HERE INFLUENCERS MODELS, VIEWS, AND CONTROLLERS SCOPING THE PROJECT BUILDS DEPLOYMENT PART 2 SPRINT RETRO: A JOURNEY OF 1000 STEPS BUILDING WEB APPLICATIONS WITH MICROSOFT AZURE CROSS-PLATFORM CONTAINERS ENTITY FRAMEWORK CORE RAZOR VIEWS CONFIGURATION AND LOGGING PART 3 SPRINT RETRO: THE BELLY OF THE BEAST IDENTITY, SECURITY, AND RIGHTS MANAGEMENT DEPENDENCY INJECTION ROLE OF JAVASCRIPT DEPENDENCY MANAGEMENT FRONT END WITH STYLE CACHING PART 4 SPRINT RETRO: HOME STRETCH REUSABLE COMPONENTS TESTING EXTENSIBILITY
INTERNATIONALIZATION REFACTORING AND IMPROVING CODE QUALITY ORGANIZING THE CODE POSTFIX Index
Table of Contents Introduction PART 1 ALPINE SKI HOUSE Chapter 1 How We Got Here Active Server Pages ASP.NET ASP.NET MVC Web API ASP.NET Core Summary Chapter 2 Influencers Backward compatibility Rails Node.js Angular and React Open source OWIN Summary Chapter 3 Models, Views, and Controllers The M, the V, and the C of it Diving into Models Views Partial Views Controllers (...and Actions!) It’s Not Just About MVC Middleware Dependency Injection Other Gems Summary Chapter 4 Scoping the Project Ski Slopes The API
The Admin View Pulling the Pieces Together Defining our Domain Summary Chapter 5 Builds Command Line Builds Build Servers The Build Pipeline Building Alpine Ski House Summary Chapter 6 Deployment Picking a web server Kestrel Reverse Proxy IIS Nginx Publishing Build Types Building A Package The Case for Azure Azure Deployments Container Deployments Summary PART 2 SPRINT RETRO: A JOURNEY OF 1000 STEPS Chapter 7 Building Web Applications with Microsoft Azure Thinking of Platform as a Service Platform Services Scaffolding, Destroying, and Recreating Your Services Building Applications Using Platform Services Creating a Storage Account Storing Images in Blob Containers Incorporating Storage Queues Automating Processing with Azure WebJobs Scaling Out Your Applications
分享到:
收藏