Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Sams Teach Yourself ASP.NET Core in 24 Hours
Nội dung xem thử
Mô tả chi tiết
About This E-Book
EPUB is an open, industry-standard format for e-books. However, support for
EPUB and its many features varies across reading devices and applications. Use
your device or app settings to customize the presentation to your liking. Settings
that you can customize often include font, font size, single or double column,
landscape or portrait mode, and figures that you can click or tap to enlarge. For
additional information about the settings and features on your reading device or
app, visit the device manufacturer’s Web site.
Many titles include programming code or configuration examples. To
optimize the presentation of these elements, view the e-book in single-column,
landscape mode and adjust the font size to the smallest setting. In addition to
presenting code and configurations in the reflowable text format, we have
included images of the code that mimic the presentation found in the print book;
therefore, where the reflowable format may compromise the presentation of the
code listing, you will see a “Click here to view code image” link. Click the link
to view the print-fidelity code image. To return to the previous page viewed,
click the Back button on your device or app.
Sams Teach Yourself ASP.NET Core
in 24 Hours
Jeffrey T. Fritz
800 East 96th Street, Indianapolis, Indiana, 46240 USA
Sams Teach Yourself ASP.NET Core in 24 Hours
Copyright © 2018 by Pearson Education, Inc.
All rights reserved. Printed in the United States of America. This publication is
protected by copyright, and permission must be obtained from the publisher
prior to any prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical,
photocopying, recording, or likewise. For information regarding permissions,
request forms, and the appropriate contacts within the Pearson Education Global
Rights & Permissions Department, please visit
www.pearsoned.com/permissions/. No patent liability is assumed with respect to
the use of the information contained herein. Although every precaution has been
taken in the preparation of this book, the publisher and author assume no
responsibility for errors or omissions. Nor is any liability assumed for damages
resulting from the use of the information contained herein.
ISBN-13: 978-0-672-33766-6
ISBN-10: 0-672-33766-5
Library of Congress Control Number: 2017955882
1 17
Trademarks
All terms mentioned in this book that are known to be trademarks or service
marks have been appropriately capitalized. Sams Publishing cannot attest to the
accuracy of this information. Use of a term in this book should not be regarded
as affecting the validity of any trademark or service mark.
Microsoft and/or its respective suppliers make no representations about the
suitability of the information contained in the documents and related graphics
published as part of the services for any purpose. All such documents and related
graphics are provided “as is” without warranty of any kind. Microsoft and/ or its
respective suppliers hereby disclaim all warranties and conditions with regard to
this information, including all warranties and conditions of merchantability,
whether express, implied or statutory, fitness for a particular purpose, title and
non-infringement. In no event shall Microsoft and/or its respective sup-pliers be
liable for any special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether in an action of
contract, negligence or other tortious action, arising out of or in connection with
the use or performance of information available from the services.
The documents and related graphics contained herein could include technical
inaccuracies or typographical errors. Changes are periodically added to the
information herein. Microsoft and/ or its respective sup-pliers may make
improvements and/or changes in the product(s) and/or the program(s) described
herein at any time. Partial screenshots may be viewed in full within the software
version specified.
Microsoft® and Windows® are registered trademarks of the Microsoft
Corporation in the U.S.A. and other countries. Screenshots and icons reprinted
with permission from the Microsoft Corporation. This book is not sponsored or
endorsed by or affiliated with the Microsoft Corporation.
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as
possible, but no warranty or fitness is implied. The information provided is on an
“as is” basis. The author and the publisher shall have neither liability nor
responsibility to any person or entity with respect to any loss or damages arising
from the information contained in this book.
Special Sales
For information about buying this title in bulk quantities, or for special sales
opportunities (which may include electronic versions; custom cover designs; and
content particular to your business, training goals, marketing focus, or branding
interests), please contact our corporate sales department at
[email protected] or (800) 382-3419.
For government sales inquiries, please contact
For questions about sales outside the U.S., please contact [email protected].
Editor-in-Chief
Mark Taub
Senior Acquisitions Editor
Trina MacDonald
Development Editor
Mark Renfrow
Managing Editor
Sandra Schroeder
Project Editor
Mandie Frank
Copy Editor
Kitty Wilson
Indexer
Lisa Stumpf
Proofreader
Abby Manheim
Technical Editor
Javier Lozano
Editorial Assistant
Courtney Martin
Designer
Chuti Prasertsith
Compositor
codeMantra
Contents at a Glance
Introduction
HOUR 1 Introducing ASP.NET Core
2 Setting Up Your Work Environment for ASP.NET Core
3 Exploring the New Project Templates
4 Defining ASP.NET Core Configuration
5 Configuring the Service with the Startup Class
6 Configuring Your Application
7 Accessing Your Data with Entity Framework Core
8 Introducing the MVC Architecture
9 Building Your First Controller
10 Beginning MVC: Writing Your First View
11 Scaffolding User Interfaces
12 Writing Data from a Controller
13 Writing Web API Methods
14 Introducing Reusable User Interface Components
15 npm and bower: Client-Side Package Managers
16 Introducing Angular
17 Connecting Angular to ASP.NET Core
18 Routing Angular Requests Around ASP.NET Core
19 Running Angular on the Server
20 Authenticating Your Users
21 Granting Access to Users
22 Deploying to Production
23 Working with Docker Containers
24 Looking to the Future and .NET Standard
Index
Table of Contents
Introduction
HOUR 1: Introducing ASP.NET Core
What Is ASP.NET?
Why Should You Program in ASP.NET?
Significant Changes in ASP.NET Core
Assumptions and Definitions in This Book
Introducing the Sample Project
Summary
Q&A
Workshop
Exercise
HOUR 2: Setting Up Your Work Environment for ASP.NET Core
Four Versions of Visual Studio: Where Do I Start?
Installing Development Tools on Non-Windows Operating Systems
Introducing the dotnet Command-Line Tool
Summary
Q&A
Workshop
Exercise
HOUR 3: Exploring the New Project Templates
Getting Started with Visual Studio 2017
The wwwroot Folder
Getting Started with Visual Studio Code
Summary
Q&A
Workshop
Exercise
HOUR 4: Defining ASP.NET Core Configuration
Introducing Our Sample Application
Getting Started with Server-Side Configuration
Fundamentals of .NET Application Structure
Managing and Referencing NuGet Packages
Summary
Q&A
Workshop
Exercise
HOUR 5: Configuring the Service with the Startup Class
Introducing the Startup Class
Summary
Q&A
Workshop
Exercise
HOUR 6: Configuring Your Application
Writing Configuration Files
Summary
Q&A
Workshop
Exercise
HOUR 7: Accessing Your Data with Entity Framework Core
Getting Started with Data
Summary
Q&A
Workshop
Exercise
HOUR 8: Introducing the MVC Architecture
Defining the MVC Architecture
Summary
Q&A
Workshop
Exercise
HOUR 9: Building Your First Controller
Reviewing the MVC Folder Structure
Summary
Q&A
Workshop
Exercise
HOUR 10: Beginning MVC: Writing Your First View
Introducing Razor Templates
Summary
Q&A
Workshop
Exercise
HOUR 11: Scaffolding User Interfaces
Introducing Scaffolding in Visual Studio 2017
Investigating the Templates
Summary
Q&A
Workshop
Exercise
HOUR 12: Writing Data from a Controller
Enhancing Scaffolded Code
Validating Data in Controller Methods
Investigating Controller Interaction Strategies
Preventing Unwanted Cross-site Posting
Speeding Up Data Access with Asynchronous Techniques
Summary
Q&A
Workshop
Exercise
HOUR 13: Writing Web API Methods
In the Old Days of ASP.NET[…]
Creating a New Trip with Web API
Updating a Trip with Web API
Deleting a Trip with Web API
Negotiating and Formatting Content
Trimming the Fat: An API-Only Application
Summary
Q&A
Workshop
Exercise
HOUR 14: Introducing Reusable User Interface Components
Introducing Tag Helpers
Tag Helpers That Ship with ASP.NET Core
Building Other Reusable Components
Writing Your Own Tag Helper
Writing a Constructor
Counting the Number of Trips
Formatting Your Trips
Using Your New Tag Helper
Summary
Q&A
Workshop
Exercise
HOUR 15: npm and bower: Client-Side Package Managers
What Are npm and bower?
Getting Started with npm
Getting Started with bower
Automating npm and bower
Installing Newer Versions of npm and bower
Summary
Q&A
Workshop
Exercise
HOUR 16: Introducing Angular
Getting Started with Angular
Exploring the Default Template Angular Website
Delivering Content to the Browser
Adding Some Real Code
Summary
Q&A
Workshop
Exercise
HOUR 17: Connecting Angular to ASP.NET Core
Connecting the Pieces
Connecting to a Running ASP.NET Core Service
Combining the Projects: Merging Angular and ASP.NET Core
Summary
Q&A
Workshop
Exercise
HOUR 18: Routing Angular Requests Around ASP.NET Core
What Is Routing?
Generating URLs from ASP.NET Core
Routing in Angular
Merging Projects: The Final Steps
Debugging and Building Your App
Summary
Q&A
Workshop
Exercise
HOUR 19: Running Angular on the Server
Introducing Angular Universal
Migrating Your Application to SpaServices
Summary
Q&A
Workshop
Exercise
HOUR 20: Authenticating Your Users
Starting a New Application
Configuring Authentication
Adding the Registration Feature
Adding the Login and Logout Features
Summary
Q&A
Workshop
Exercise