Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
C# 7 and .NET Core 2.0 Blueprints
C# 7 and .NET Core 2.0 Blueprints

C# 7 and .NET Core 2.0 Blueprints: Build effective applications that meet modern software requirements

eBook
€22.99 €32.99
Paperback
€41.99
Subscription
Free Trial
Renews at €18.99p/m

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

C# 7 and .NET Core 2.0 Blueprints

Cricket Score Calculator and Tracker

Object-oriented programming (OOP) is a crucial element of writing .NET applications. Proper OOP ensures that developers can share code easily between projects. You don't have to rewrite code that has already been written. This is called inheritance.

A lot has been written throughout the years on the topic of OOP. In fact, doing a search on the internet on the benefits of OOP will return countless results. The fundamental benefits of OOP, however, are the modular approach to writing code, the ease with which code can be shared, and the ability to extend the functionality of shared code.

These little building blocks (or classes) are self-contained units of code that each perform a function. Developers do not need to know what goes on inside the class when they use it. They can just assume that the class will function on its own and will...

Setting up the project

Using Visual Studio 2017, we will create an ASP.NET Web Application project. You can call the application anything you like, but I called mine cricketScoreTrack. When you click on the new ASP.NET Web Application template, you will be presented with a few ASP.NET templates.

The ASP.NET templates are:

  • Empty
  • Web Forms
  • MVC
  • Web API
  • Single Page Application
  • Azure API App
  • Azure Mobile App

We are just going to select the Web Forms template. For this application, we don't need authentication, so don't change this setting:

I will assume that you have also downloaded the application from GitHub for this chapter, because you will need it as we discuss the architecture. The URL is—https://github.com/PacktPublishing/CSharp7-and-.NET-Core-2.0-Blueprints/tree/master/cricketScoreTrack.

Click on OK to create the web application. The project will be created...

Object-oriented programming

As briefly mentioned earlier, OOP provides a modular approach to writing self-contained units of code. The concept of OOP centers around what we call the four pillars of object-oriented programming.

They are as follows:

  • Abstraction
  • Polymorphism
  • Inheritance
  • Encapsulation

The order doesn't really matter, but I always write the four pillars in this order because I use the mnemonic A PIE to remember each one. Let's discuss each of these concepts in more detail.

Abstraction

An abstraction describes what something should do without actually showing you how to do it. According to the Microsoft documentation:

"An abstraction is a type that describes a contract but does not provide a full...

Classes in Cricket Score Tracker

Taking what we have already learned about the four pillars of OOP, we will have a look at the areas in our application that make use of these concepts to provide the building blocks of Cricket Score Tracker.

Abstract classes

Open up the BaseClasses folder and double click on the Player.cs file. You will see the following code:

namespace cricketScoreTrack.BaseClasses 
{ 
    public abstract class Player 
    { 
        public abstract string FirstName { get; set; } 
        public abstract string LastName { get; set; } 
        public abstract int Age { get; set; } 
        public abstract string Bio { get; set; } 
    } 
} 

This is our abstract class. The abstract modifier in the class declaration...

Putting it all together

Now, let's have a look how we use the classes to create the Cricket Score Tracker app. The buttons below the Batters section and Bowler section are used to select batsmen and a bowler for the specific over.

While each button is taken care of by its own click event, they all call the exact same method. We will have a look at how that is accomplished in a moment:

Clicking on either button under the Batsmen section will display a modal dialog with a drop-down list populated with the batsmen in the team:

Similarly, when we click on the Select Bowler button, we will see the exact same modal dialog screen displayed. This time, however, it will be a list of bowlers displayed for selection:

Selecting players from the drop-down lists will populate the text on the button clicked with that player's name. This then sets up the current over with the players...

Summary

While the principles of SOLID programming are great guidelines to follow, very few systems that you come across will actually implement them throughout the application. This is especially true if you inherit a system and that system has been in production for a number of years.

I will admit that I have come across applications designed with SOLID in mind. These were really easy to work on and the bar is set high for other developers in a team to maintain the same level of code quality.

Peer code reviews and a thorough understanding of SOLID principles by every developer on the team ensure that the same level of code is maintained.

This chapter has had a lot going on. Apart from laying the foundation for a really nice Cricket Score Tracking app, we have had a look at what OOP really means.

We had a look at abstraction and the difference between abstraction and encapsulation...

Left arrow icon Right arrow icon

Key benefits

  • Easy-to-follow real-world projects that get you up and running with the new features of C# 7 and .NET Core 2.0
  • The practical applications will assist you with concepts such as Entity Framework Core, serverless computing, and more in .NET Core 2.0
  • Explore OAuth concepts and build ASP.NET Core applications using MongoDB

Description

.NET Core is a general purpose, modular, cross-platform, and open source implementation of .NET. With the latest release of .NET Core, many more APIs are expected to show up, which will make APIs consistent across .Net Framework, .NET Core, and Xamarin. This step-by-step guide will teach you the essential .NET Core and C# concepts with the help of real-world projects. The book starts with a brief introduction to the latest features of C# 7 and .NET Core 2.0 before moving on to explain how C# 7 can be implemented using the object-oriented paradigm. You'll learn to work with relational data using Entity Framework and see how to use ASP.NET Core practically. This book will show you how .NET Core allows the creations of cross-platform applications. You'll also learn about SignalR to add real-time functionality to your application. Then you will see how to use MongoDB and how to implement MongoDB into your applications. You'll learn about serverless computing and OAuth concepts, along with running ASP.NET Core applications with Docker Compose. This project-based guide uses practical applications to demonstrate these concepts. By the end of the book, you'll be proficient in developing applications using .NET Core 2.0.

Who is this book for?

This book is for .NET developers who would like to master and implement C# 7 and .NET Core 2.0 with practical projects. Basic knowledge of .NET Core and C# is assumed.

What you will learn

  • • How to incorporate Entity Framework Core to build ASP .NET Core MVC applications
  • • Get hands-on experience with SignalR, and NuGet packages
  • • Working with MongoDB in your ASP.NET Core MVC application
  • • Get hands-on experience with .NET Core MVC, Middleware, Controllers, Views, Layouts, Routing, and OAuth
  • • Implementing Azure Functions and learn what Serverless computing means
  • • See how .NET Core enables cross-platform applications that run on Windows, macOS and Linux
  • • Running a .NET Core MVC application with Docker Compose

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 28, 2018
Length: 428 pages
Edition : 1st
Language : English
ISBN-13 : 9781788398138
Vendor :
Microsoft
Category :
Languages :
Tools :

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 : Mar 28, 2018
Length: 428 pages
Edition : 1st
Language : English
ISBN-13 : 9781788398138
Vendor :
Microsoft
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.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
€189.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
€264.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 120.97
Building Microservices with .NET Core 2.0
€36.99
C# 7 and .NET Core 2.0 Blueprints
€41.99
.NET Core 2.0 By Example
€41.99
Total 120.97 Stars icon
Banner background image

Table of Contents

10 Chapters
eBook Manager and Catalogue App Chevron down icon Chevron up icon
Cricket Score Calculator and Tracker Chevron down icon Chevron up icon
Cross Platform .NET Core System Info Manager Chevron down icon Chevron up icon
Task Bug Logging ASP .NET Core MVC App Chevron down icon Chevron up icon
ASP.NET SignalR Chat Application Chevron down icon Chevron up icon
Web Research Tool with Entity Framework Core Chevron down icon Chevron up icon
A Serverless Email Validation Azure Function Chevron down icon Chevron up icon
Twitter Clone Using OAuth Chevron down icon Chevron up icon
Using Docker and ASP.NET Core Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Prakash Mar 28, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Hi Guys. I was the technical reviewer of this book. The sequence of topics are arranged nicely that makes easy for readers to follow. Practical tips are added wherever required to make it more useful for day-to-day work. The best part of this book is project driven approach that let you apply the concept in the working demo to concrete the understanding and make yourself comfortable enough to apply the same in your day-to-day programming. Moreover, this book not only talks about using C# 7 and .NET Core but also the related topics to get best out of it, In summary, It has great content and code examples and worth buying.
Amazon Verified review Amazon
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.