Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
ASP.NET Core MVC 2.0 Cookbook
ASP.NET Core MVC 2.0 Cookbook

ASP.NET Core MVC 2.0 Cookbook: Effective ways to build modern, interactive web applications with ASP.NET Core MVC 2.0

Arrow left icon
Profile Icon Jason De Oliveira Profile Icon Polat Profile Icon Belkheraz
Arrow right icon
Mex$179.99 Mex$902.99
eBook Feb 2018 668 pages 1st Edition
eBook
Mex$179.99 Mex$902.99
Paperback
Mex$1128.99
Subscription
Free Trial
Arrow left icon
Profile Icon Jason De Oliveira Profile Icon Polat Profile Icon Belkheraz
Arrow right icon
Mex$179.99 Mex$902.99
eBook Feb 2018 668 pages 1st Edition
eBook
Mex$179.99 Mex$902.99
Paperback
Mex$1128.99
Subscription
Free Trial
eBook
Mex$179.99 Mex$902.99
Paperback
Mex$1128.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

ASP.NET Core MVC 2.0 Cookbook

Visual Studio 2017, C# 6, IDEs, and Roslyn

In this chapter, we will cover:

  • 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 new C# 6 features

Introduction

In this chapter, we will learn about the most interesting new features of Visual Studio 2017.
We will use Visual Studio Code as a cross-platform editor for C# and some other languages.

We will install the OmniSharp library to have the benefits of intellisense and language support, just as VS does, on other IDEs on macOS and Linux.

We will also discover the new open source and cross-platform compiler named Roslyn, and will understand what its different APIs will bring to us.

Finally, we will discover some useful and relevant new C# 6 features.

Working with Visual Studio 2017

There are many new or enhanced features in VS 2017. Let's have a look at a few of them.

How to do it...

  1. Feature one—VS project templates:
    1. We will find a large number of project templates and samples by going to Menu | File | New Project | Installed.
    2. Select a project template related to the technology or language you want to develop with.
    3. We can also download a lot of project templates by going to Menu | File | New Project | Online.
    4. You can search for a template that matches with a technology.

We want to use all the projects which are not necessarily reliable, so it's up to us to verify that. The New Project dialog box appears:

  1. Visual Studio Gallery to add extensions...

Working with Visual Studio Code

VS Code is a cross-platform, command-line, and file-folder editor. It can be installed on Windows, Linux, or macOS. We can see VS Code as a cross-platform, lightweight version of VS.

Getting ready

How to do it...

  1. Let's launch VS Code by double-clicking on Code in the VSCode-linux-x64 folder:

This will open VS Code:

We can press F1 to make the command palette appear, which gives you access to all the functionality of VS Code.

This way, you can also browse...

Installing and using OmniSharp on macOS

This recipe explains what OmniSharp is, how to install it, and how it is used on macOS.

How to do it...

In most of the previously mentioned text editors, a package manager is included and will be used to install the OmniSharp package:

  1. Edit code on macOS with Atom:
  1. Let's install the OmniSharp package on Atom:
  1. Next, let's create a new project:
  1. Now that OmniSharp is installed, we can use the project scaffolding for .NET projects:
  1. After choosing Web Application, the project and the associated files are generated.
  1. We can see the Startup.cs class generated:

At the bottom of the picture, we can see the OmniSharp features on Atom, with the little green OmniSharp icon...

Installing and using OmniSharp on Linux

In this recipe, we will install and use OmniSharp with the Atom IDE on Linux.

Getting ready

For this recipe, we will use Ubuntu 14.04 VM. We have to make sure that we have followed recipe three to ensure Mono, DNVM, and the Kestrel web server are installed.

How to do it...

  1. First, let's add a repository:
sudo add-apt-get repository ppa:webudp8team/atom
  1. Next, we update the repository:
sudo apt-get update
  1. After that, we install Atom:
sudo apt-get install atom
  1. Now we can launch Atom by typing atom in the command line...

Working with Roslyn

We often think about a compiler as a black box which produces an output from an input. Compilers were generally written in C++ because of speed, custom memory, file, and thread management needs. For example, the C# compiler takes .cs files in input and generates .dll files in output.

Now the new Microsoft compiler written in C# and VB, Roslyn, is not just a compiler; it's a .NET compiler platform that we can extend.

Getting ready

Learning to use all Roslyn APIs could be the subject of an entire book. In this recipe, we will just manipulate one of these APIs: the Syntax Trees API. We will create a Syntax Tree and we will analyze it.

...

Using C# 6 new features

In this recipe, we will discover some of the new features in C# 6.

How to do it...

  1. Feature one—auto initializer for properties:

Before C# 6, we should initialize a property with a value in the class constructor. There is no point in time before the class constructor, so we should use it. Thanks to C# 6 syntax, we can now initialize a property with a value right on the declaration line. No need to use constructor anymore:

    • Before:
public class Person
{
Public class Name {get;set;}
Public Person(){
Name = "Stephane";
}
}
    • Now:
Public string Name {get;set;} = "Stephane";
  1. Feature two—auto initializer for static properties:

Auto initializers can be applied to...

Left arrow icon Right arrow icon

Key benefits

  • • Practical solutions to recurring issues in the web development world
  • • Recipes on the latest features of ASP.Net Core 2.0
  • • Coverage of Bootstrap, Angular, and JavaScript lets you supercharge your frontend

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.

Who is this book for?

This book is written for the ASP.NET developer who wants to deliver professional-standard software, quickly and efficiently. It's filled with hands-on recipes, practical advice, and guidance to help developers with every aspect of the ASP.NET development cycle. Whether you've just started out or are a seasoned pro, the Asp.Net Core 2.0 Cookbook is written for you.

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

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 27, 2018
Length: 668 pages
Edition : 1st
Language : English
ISBN-13 : 9781785889660
Vendor :
Microsoft
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Feb 27, 2018
Length: 668 pages
Edition : 1st
Language : English
ISBN-13 : 9781785889660
Vendor :
Microsoft
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Mex$ 3,138.97
ASP.NET Core MVC 2.0 Cookbook
Mex$1128.99
ASP.NET Core 2 and Angular 5
Mex$1004.99
Learning ASP.NET Core 2.0
Mex$1004.99
Total Mex$ 3,138.97 Stars icon
Banner background image

Table of Contents

20 Chapters
Cross-Platform with .NET Core Chevron down icon Chevron up icon
Visual Studio 2017, C# 6, IDEs, and Roslyn Chevron down icon Chevron up icon
Working with npm, Frontend Package Managers, and Task Runners Chevron down icon Chevron up icon
Reusing Code with NuGet Chevron down icon Chevron up icon
SOLID Principles, Inversion of Control, and Dependency Injection Chevron down icon Chevron up icon
Data Access - EF7 with Repository, SQL Server, and Stored Procedures Chevron down icon Chevron up icon
Accessing data with Micro ORMs, NoSQL, and Azure Chevron down icon Chevron up icon
Cache and Session - Distributed, Server, and Client Chevron down icon Chevron up icon
Routing Chevron down icon Chevron up icon
ASP.NET Core MVC Chevron down icon Chevron up icon
Web API Chevron down icon Chevron up icon
Filters Chevron down icon Chevron up icon
Views, Models, and ViewModels Chevron down icon Chevron up icon
Razor and Views Chevron down icon Chevron up icon
TagHelpers and ViewComponents Chevron down icon Chevron up icon
OWIN and Middleware Chevron down icon Chevron up icon
Security Chevron down icon Chevron up icon
Frontend Development Chevron down icon Chevron up icon
Deployment and Hosting Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.