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 now! 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
Conferences
Free Learning
Arrow right icon
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 Belkheraz Profile Icon Polat Profile Icon Jason De Oliveira
Arrow right icon
$54.99
Paperback Feb 2018 668 pages 1st Edition
eBook
$29.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Belkheraz Profile Icon Polat Profile Icon Jason De Oliveira
Arrow right icon
$54.99
Paperback Feb 2018 668 pages 1st Edition
eBook
$29.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$29.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
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
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
Estimated delivery fee Deliver to Egypt

Standard delivery 10 - 13 business days

$12.95

Premium delivery 3 - 6 business days

$34.95
(Includes tracking information)

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 : 9781785886751
Vendor :
Microsoft
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
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
Estimated delivery fee Deliver to Egypt

Standard delivery 10 - 13 business days

$12.95

Premium delivery 3 - 6 business days

$34.95
(Includes tracking information)

Product Details

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

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 $5 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 $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 152.97
Learning ASP.NET Core 2.0
$48.99
ASP.NET Core 2 and Angular 5
$48.99
ASP.NET Core MVC 2.0 Cookbook
$54.99
Total $ 152.97 Stars icon

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

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business da