You are previewing ASP.NET Core Essentials.
O'Reilly logo
ASP.NET Core Essentials

Book Description

Develop and deploy modern cross-platform web applications with ASP.NET Core

About This Book

  • Develop modern web applications from scratch

  • Integrate server-side and client-side code with modern tools

  • Be prepared for the real world with unit tests and cloud deployment

  • Who This Book Is For

    This book is for software developers who have experience in .NET, preferably with C# or some other Object-Oriented Programming Language, which is required in order to build ASP.NET Core web applications. A basic understanding of web application development is also essential.

    What You Will Learn

  • Develop ASP.NET web applications from scratch

  • Use MVC to build all parts of a web application

  • Use Web API to support browsers and mobile apps

  • Simplify development with client-side tools

  • Use Entity Framework to integrate with your database

  • Implement Dependency Injection to build testable software

  • Build web solutions with performance and security in mind

  • Deploy to the cloud and scale with ease

  • In Detail

    ASP.NET Core is the latest collection of Microsoft’s web application development technologies. When you’re trying to reach a broad spectrum of users with a robust web application, ASP.NET Core is there to help you build that application. With the ability to cater to users on desktop, tablet, or smartphone platforms, you can put together a solution that works well anywhere.

    This book is what you need to get started developing ASP.NET Core applications was quickly as possible; starting by introducing the software and how it can be used in today’s modern world of web applications and smartphone apps. Walking you through the benefits of a Web API to support both applications and mobile apps to give you a solid understanding of the tech to build upon as you see what ASP.NET Core can do for you.

    The book wraps up with practical guidelines for the use of database technologies, unit tests, security best practices, and cloud deployments for the real world.

    Style and approach

    This is a comprehensive guide for .NET developers to build the next generation of web apps. This book can be read from start to finish, but you can also come back to any chapter for a quick refresher, as each chapter is modularized for specific concepts.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. ASP.NET Core Essentials
      1. ASP.NET Core Essentials
      2. Credits
      3. About the Author
      4. About the Reviewer
      5. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why subscribe?
      6. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      7. 1. Getting Started with ASP.NET Core
        1. ASP.NET Core - Unifying MVC, Web API, and Web Pages
          1. High-level overview
          2. Version numbers
          3. Putting it all together
        2. Differences between .NET Framework and .NET Core
          1. Full .NET Framework 4.6
          2. Lightweight .NET Core
          3. Running ASP.NET Core on .NET Framework versus .NET Core
        3. What's new with Visual Studio 2015 and Visual Studio Code?
          1. Community Edition
          2. Professional and Enterprise Editions
          3. Visual Studio Code
        4. Running ASP.NET Core on Windows, Mac OS X, and Linux
          1. ASP.NET Core on Windows
          2. ASP.NET Core on Mac OS X
          3. ASP.NET Core on Linux
        5. Summary
      8. 2. Building Your First ASP.NET Core Application
        1. Project templates in Visual Studio 2015
          1. Empty template
          2. Web API template
          3. Web Application template
        2. Hello, ASP.NET - your first ASP.NET application
          1. Writing a response
          2. Launching the application
          3. Web files and folders
        3. Models, views, and controllers - an MVC refresher
          1. Controllers
          2. Models
          3. Views
        4. Web configuration with project.json
          1. Dependencies and frameworks
          2. Commands and tools
          3. Bundling and publishing
        5. Summary
      9. 3. Understanding MVC
        1. Building controllers
          1. Controller methods
          2. Basic controllers
          3. URL routes and conventions
        2. Implementing views
          1. Basic views
          2. Tag helpers in views
          3. ViewData, ViewBag, and TempData
        3. Designing models and ViewModels
          1. Creating models
          2. Binding models to views
          3. ViewModels and mapping
        4. Bringing it all together
          1. Scaffolding, validation, and model binding
          2. Database setup and data entry
          3. Exception handling
        5. Summary
      10. 4. Using Web APIs to Extend Your Application
        1. Understanding a Web API
          1. The case for Web APIs
          2. Creating a new Web API project from scratch
          3. Building your Web API project
        2. Configuring the Web API in your web application
          1. Setting up dependencies
          2. Parts of a Web API project
          3. Running the Web API project
        3. Adding routes to handle anticipated URL paths
          1. Understanding routes
          2. Setting up routes
          3. Testing routes
        4. Consuming a Web API from a client application
          1. Testing with external tools
          2. Consuming a Web API from a mobile app
          3. Consuming a Web API from a web client
        5. Summary
      11. 5. Interacting with Web API using JavaScript
        1. Using JavaScript to interact with Web API
          1. Preparing the server-side code
          2. Client-side JavaScript
          3. JavaScript frameworks
        2. Single-page applications with AngularJS
          1. Getting started with AngularJS
          2. AngularJS syntax and features
          3. Building a web application with AngularJS
        3. Model-View-ViewModel (MVVM) with KnockoutJS
          1. Getting started with KnockoutJS
          2. KnockoutJS syntax and features
          3. Building a web application with KnockoutJS
        4. Task runners, bundling, and minification using Bower, Grunt, and Gulp
          1. Why do we need task automation?
          2. Using Bower as your package manager
          3. Using Gulp and Grunt as task runners
        5. Summary
      12. 6. Using Entity Framework to Interact with Your Database in Code
        1. Object-relational mapping in .NET
          1. Why use an ORM?
          2. Why Entity Framework?
          3. The evolution of Entity Framework
        2. EF 6.x for .NET Framework versus EF Core 1.0
          1. What's different in EF Core
          2. Getting started with EF Core
          3. What else is new?
        3. Code First approach to database design and relationships
          1. Updating the models
          2. Updating the controllers
          3. Updating the views
        4. EF Code First migrations for database versioning and maintenance
          1. Setting up migrations
          2. Adding and removing migrations
          3. Running your application
        5. Summary
      13. 7. Dependency Injection and Unit Testing for Robust Web Apps
        1. Understanding IoC
          1. Pros and cons of DI
          2. SOLID principles and Gang of Four patterns
          3. Loose coupling
        2. Implementing DI in ASP.NET Core
          1. Lifecycle management
          2. Constructor injection versus action injection
          3. Verifying the expected behavior
        3. DI options in ASP.NET Core
          1. Built-in IoC
          2. Autofac
          3. Other alternatives
        4. Writing unit tests
          1. Setting up a test project
          2. Running unit tests
          3. Going beyond the basics
        5. Summary
      14. 8. Authentication, Authorization, and Security
        1. Enabling authentication in ASP.NET
          1. High-level overview
          2. Authentication configuration
          3. External service providers
        2. Using authorization for application features
          1. High-level overview
          2. Basic authorization
          3. Roles and claims
        3. Protecting your data
          1. Data protection in ASP.NET Core
          2. Implementing data protection
          3. How it all works
        4. Implementing web application security
          1. Cross-site scripting
          2. Anti-forgery
          3. Cross-origin requests
        5. Summary
      15. 9. Deploying Your Application
        1. Deployment options
          1. Environment configuration
          2. Deploying your web app
          3. Deploying your database
        2. Deploying to IIS
          1. Setting up IIS
          2. Using the filesystem
          3. Importing a publish profile
        3. Deploying to Azure, Microsoft's cloud platform
          1. Creating a web app
          2. Creating a virtual machine
          3. Deploying to Azure
        4. Continuous integration
          1. Preparing for CI
          2. Setting up Continuous Deployment
          3. The pitfalls of CI
        5. Summary