ASP.NET Core MVC 2.0 Cookbook

Learn to implement ASP.NET Core features to build effective software that can be scaled and maintained easily
Preview in Mapt

ASP.NET Core MVC 2.0 Cookbook

Engin Polat, Stephane Belkheraz

Learn to implement ASP.NET Core features to build effective software that can be scaled and maintained easily
Mapt Subscription
FREE
$29.99/m after trial
eBook
$28.00
RRP $39.99
Save 29%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$28.00
$49.99
$29.99 p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


ASP.NET Core MVC 2.0 Cookbook Book Cover
ASP.NET Core MVC 2.0 Cookbook
$ 39.99
$ 28.00
Mastering ASP.NET Core 2.0 Book Cover
Mastering ASP.NET Core 2.0
$ 39.99
$ 28.00
Buy 2 for $35.00
Save $44.98
Add to Cart

Book Details

ISBN 139781785886751
Paperback668 pages

Book Description

The ASP.NET Core 2.0 Framework has been designed to meet all the needs of today’s web developers. It provides better control, support for test-driven development, and cleaner code. Moreover, it’s lightweight and allows you to run apps on Windows, OSX and Linux, making it the most popular web framework with modern day developers.

This book takes a unique approach to web development, using real-world examples to guide you through problems with ASP.NET Core 2.0 web applications. It covers Visual Studio 2017- and ASP.NET Core 2.0-specifc changes and provides general MVC development recipes. It explores setting up .NET Core, Visual Studio 2017, Node.js modules, and NuGet. Next, it shows you how to work with Inversion of Control data pattern and caching. We explore everyday ASP.NET Core MVC 2.0 patterns and go beyond it into troubleshooting. Finally, we lead you through migrating, hosting, and deploying your code.

By the end of the book, you’ll not only have explored every aspect of ASP.NET Core MVC 2.0, you’ll also have a reference you can keep coming back to whenever you need to get the job done.

Table of Contents

Chapter 1: Cross-Platform with .NET Core
What is ASP.NET Core 2.0?
What's new in ASP.NET and CLR?
Installing or updating .NET Core
Managing NuGet packages in ASP.NET Core applications
Creating an ASP.NET Core MVC application on Linux
Creating an ASP.NET Core MVC application on Linux with Docker
Creating an ASP.NET Core MVC application on macOS
Creating and running an ASP.NET Core MVC application on Azure
Chapter 2: Visual Studio 2017, C# 6, IDEs, and Roslyn
Introduction
Working with Visual Studio 2017
Working with Visual Studio Code
Installing and using OmniSharp on macOS
Installing and using OmniSharp on Linux
Working with Roslyn
Using C# 6 new features
Chapter 3: Working with npm, Frontend Package Managers, and Task Runners
Introduction
Using and creating npm modules
Managing frontend dependencies with Bower
Compiling LESS files to CSS files with Grunt
Bundling and minifying JavaScript files with Gulp
Using Yeoman code-generated templates
Using JSPM
Chapter 4: Reusing Code with NuGet
Introduction
Managing NuGet packages
Creating a NuGet package with the NuGet package class library
Creating a local NuGet repository and consuming packages from it
Creating a NuGet package with NuGet Package Explorer
Sharing NuGet packages with the community
Creating an Azure NuGet repository
Chapter 5: SOLID Principles, Inversion of Control, and Dependency Injection
Introduction
Implementing DI with Native IOC in ASP.NET Core
Using the life cycles available in ASP.NET Core
Implementing DI with Autofac
Implementing DI with StructureMap
Implementing DI with DryIoc
Chapter 6: Data Access - EF7 with Repository, SQL Server, and Stored Procedures
Introduction
Configuring the IOC life cycle for the repository pattern
Using EF with an existing database
Using an InMemory provider
Managing a long request batch
Using a stored procedure with EF
Writing an EF provider
Chapter 7: Accessing data with Micro ORMs, NoSQL, and Azure
Introduction
Accessing data with Dapper
Accessing data with OrmLite
Accessing data with MongoDb
Accessing data with Windows Azure storage tables
Accessing data with Azure storage Blobs
Accessing data with SQL Azure
Chapter 8: Cache and Session - Distributed, Server, and Client
Introduction
Using .NET Cache with MemoryCache
Caching HTML with Cache TagHelpers
Using ResponseCache attribute
Using Session
Using Redis as Cache on-Premises
Using Redis as a cache on Azure
Caching with HTML5 cache manifest
Caching with HTML5 localStorage and sessionStorage
Chapter 9: Routing
Before ASP.NET Core
Since ASP.NET Core
MVC and Web API routing
The route order
Routing with ASP.NET Core
Creating a route using convention routing
Creating a route using attribute routing
Creating a custom route using IRouter
Creating a route constraint
Creating a domain route
Creating SEO-friendly routes
Chapter 10: ASP.NET Core MVC
Injecting dependencies and configuring IoC for a controller
Using ActionResults
Creating and working with areas
Creating and using POCO controllers
Creating and using controllers with MediatR
Managing exceptions
Chapter 11: Web API
Using ActionResult
Configuring content negotiation
Configuring cross-domain origin requests
Using Swagger
Testing Web API
Managing exceptions
Chapter 12: Filters
Introduction
Managing authentication and authorization with policies, requirements, and filters
Managing dependency injection with filters
Creating and using an action filter
Creating and using a result filter
Creating and using a resource filter
Creating and using an exception filter
Using a filter globally versus using a middleware
Chapter 13: Views, Models, and ViewModels
Creating and using a ViewModel with AutoMapper
Understanding and using ModelBinding
Creating our own model binder
Understanding and using a value provider
Configuring and using validation
Chapter 14: Razor and Views
Managing namespaces in views with ViewImports
Creating a strongly typed Partial view
Configuring view and area locations
Using dependency injection in views
Creating HTMLHelpers
Chapter 15: TagHelpers and ViewComponents
Using Environment, Script, and Link TagHelpers
Using Form TagHelpers
Creating TagHelpers programmatically
Creating a reusable view component
Creating a view component/controller class
Chapter 16: OWIN and Middleware
Understanding OWIN, Katana, and the new ASP.NET Core HTTP pipeline
Using inline middleware code as anonymous methods - Use, Run, Map, and MapWhen
Creating a reusable middleware component
Migrating an HTTP handler to middleware
Migrating HTTP modules to middleware
Chapter 17: Security
Introduction
Authentication in ASP.NET, using cookie authentication
Authentication using authorization servers
Managing identity
Securing data with Hashing
Securing data with Encryption
Chapter 18: Frontend Development
Using Bootstrap
Writing clean JavaScript
RequireJS
Typescript
Writing and executing unit tests in JavaScript
Debugging JavaScript code in browsers
Chapter 19: Deployment and Hosting
Deployment options
Hosting an ASP.NET Core web app on IIS
Hosting an ASP.NET Core web application on Kestrel
Hosting an ASP.NET Core web app on Azure
Hosting an ASP.NET Core web app in Docker containers

What You Will Learn

  • Build ASP.Net Core 2.0 applications using HTTP services with WebApi
  • Learn to unit-test, load test, and perform test applications using client-side and server-side frameworks
  • Debug, monitor and troubleshoot ASP.Net Core 2.0 applications using popular tools
  • Reuse components with NuGet and create modular components with middleware
  • Create applications using client-side technologies such as HTML5, JavaScript, jQuery, and Angular
  • Build responsive and dynamic UIs for your MVC apps using Bootstrap
  • Leverage tools like Karma, Jasmine, QUnit, xUnit, Selenium, Microsoft Fakes, and Visual Studio 2017 Enterprise

Authors

Table of Contents

Chapter 1: Cross-Platform with .NET Core
What is ASP.NET Core 2.0?
What's new in ASP.NET and CLR?
Installing or updating .NET Core
Managing NuGet packages in ASP.NET Core applications
Creating an ASP.NET Core MVC application on Linux
Creating an ASP.NET Core MVC application on Linux with Docker
Creating an ASP.NET Core MVC application on macOS
Creating and running an ASP.NET Core MVC application on Azure
Chapter 2: Visual Studio 2017, C# 6, IDEs, and Roslyn
Introduction
Working with Visual Studio 2017
Working with Visual Studio Code
Installing and using OmniSharp on macOS
Installing and using OmniSharp on Linux
Working with Roslyn
Using C# 6 new features
Chapter 3: Working with npm, Frontend Package Managers, and Task Runners
Introduction
Using and creating npm modules
Managing frontend dependencies with Bower
Compiling LESS files to CSS files with Grunt
Bundling and minifying JavaScript files with Gulp
Using Yeoman code-generated templates
Using JSPM
Chapter 4: Reusing Code with NuGet
Introduction
Managing NuGet packages
Creating a NuGet package with the NuGet package class library
Creating a local NuGet repository and consuming packages from it
Creating a NuGet package with NuGet Package Explorer
Sharing NuGet packages with the community
Creating an Azure NuGet repository
Chapter 5: SOLID Principles, Inversion of Control, and Dependency Injection
Introduction
Implementing DI with Native IOC in ASP.NET Core
Using the life cycles available in ASP.NET Core
Implementing DI with Autofac
Implementing DI with StructureMap
Implementing DI with DryIoc
Chapter 6: Data Access - EF7 with Repository, SQL Server, and Stored Procedures
Introduction
Configuring the IOC life cycle for the repository pattern
Using EF with an existing database
Using an InMemory provider
Managing a long request batch
Using a stored procedure with EF
Writing an EF provider
Chapter 7: Accessing data with Micro ORMs, NoSQL, and Azure
Introduction
Accessing data with Dapper
Accessing data with OrmLite
Accessing data with MongoDb
Accessing data with Windows Azure storage tables
Accessing data with Azure storage Blobs
Accessing data with SQL Azure
Chapter 8: Cache and Session - Distributed, Server, and Client
Introduction
Using .NET Cache with MemoryCache
Caching HTML with Cache TagHelpers
Using ResponseCache attribute
Using Session
Using Redis as Cache on-Premises
Using Redis as a cache on Azure
Caching with HTML5 cache manifest
Caching with HTML5 localStorage and sessionStorage
Chapter 9: Routing
Before ASP.NET Core
Since ASP.NET Core
MVC and Web API routing
The route order
Routing with ASP.NET Core
Creating a route using convention routing
Creating a route using attribute routing
Creating a custom route using IRouter
Creating a route constraint
Creating a domain route
Creating SEO-friendly routes
Chapter 10: ASP.NET Core MVC
Injecting dependencies and configuring IoC for a controller
Using ActionResults
Creating and working with areas
Creating and using POCO controllers
Creating and using controllers with MediatR
Managing exceptions
Chapter 11: Web API
Using ActionResult
Configuring content negotiation
Configuring cross-domain origin requests
Using Swagger
Testing Web API
Managing exceptions
Chapter 12: Filters
Introduction
Managing authentication and authorization with policies, requirements, and filters
Managing dependency injection with filters
Creating and using an action filter
Creating and using a result filter
Creating and using a resource filter
Creating and using an exception filter
Using a filter globally versus using a middleware
Chapter 13: Views, Models, and ViewModels
Creating and using a ViewModel with AutoMapper
Understanding and using ModelBinding
Creating our own model binder
Understanding and using a value provider
Configuring and using validation
Chapter 14: Razor and Views
Managing namespaces in views with ViewImports
Creating a strongly typed Partial view
Configuring view and area locations
Using dependency injection in views
Creating HTMLHelpers
Chapter 15: TagHelpers and ViewComponents
Using Environment, Script, and Link TagHelpers
Using Form TagHelpers
Creating TagHelpers programmatically
Creating a reusable view component
Creating a view component/controller class
Chapter 16: OWIN and Middleware
Understanding OWIN, Katana, and the new ASP.NET Core HTTP pipeline
Using inline middleware code as anonymous methods - Use, Run, Map, and MapWhen
Creating a reusable middleware component
Migrating an HTTP handler to middleware
Migrating HTTP modules to middleware
Chapter 17: Security
Introduction
Authentication in ASP.NET, using cookie authentication
Authentication using authorization servers
Managing identity
Securing data with Hashing
Securing data with Encryption
Chapter 18: Frontend Development
Using Bootstrap
Writing clean JavaScript
RequireJS
Typescript
Writing and executing unit tests in JavaScript
Debugging JavaScript code in browsers
Chapter 19: Deployment and Hosting
Deployment options
Hosting an ASP.NET Core web app on IIS
Hosting an ASP.NET Core web application on Kestrel
Hosting an ASP.NET Core web app on Azure
Hosting an ASP.NET Core web app in Docker containers

Book Details

ISBN 139781785886751
Paperback668 pages
Read More

Read More Reviews

Recommended for You

Mastering ASP.NET Core 2.0 Book Cover
Mastering ASP.NET Core 2.0
$ 39.99
$ 28.00
Learning ASP.NET Core 2.0 Book Cover
Learning ASP.NET Core 2.0
$ 35.99
$ 25.20
Dependency Injection in .NET Core 2.0 Book Cover
Dependency Injection in .NET Core 2.0
$ 39.99
$ 28.00
Learning ASP.NET Core MVC Programming Book Cover
Learning ASP.NET Core MVC Programming
$ 35.99
$ 25.20
C# 7 and .NET Core Cookbook Book Cover
C# 7 and .NET Core Cookbook
$ 39.99
$ 28.00
ASP.NET Core: Cloud-ready, Enterprise Web Application Development Book Cover
ASP.NET Core: Cloud-ready, Enterprise Web Application Development
$ 79.99
$ 56.00