O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

C# 7 and .NET Core 2.0 Blueprints

Book Description

Leverage the features of C# 7 and .NET core 2.0 to build real-world .NET core applications

About This Book

  • See how to incorporate Entity Framework Core to build ASP .NET core MVC application
  • Get hands-on SignalR and NuGet packages
  • Work with Reactive Extensions (Rx.Net) using the elasticsearch tool
  • Get hands-on with .NET Core MVC, Middleware, Controllers, Views, Layouts, Routing, and authentication
  • Implement Azure Service Fabric and Microservices and AWS, S3,Serverless computing
  • Work on .NET Core cross-platform functionality
  • Run a .NET Core MVC application with Docker compose
  • 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, microservices, and more in .NET Core 2.0
  • Explore the workings of Rx.Net and build cross-platform mobile applications using Xamarin

Who This Book Is 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

In Detail

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 profcient in developing applications using .NET Core 2.0

Style and approach

This comprehensive guide uses 11 real-world practical projects to implement .NET Core and C# concepts step by step.

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 files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. C# 7 and .NET Core 2.0 Blueprints
  3. Dedication
  4. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  5. Contributors
    1. About the authors
    2. About the reviewer
    3. Packt is searching for authors like you
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Conventions used
    4. Get in touch
      1. Reviews
  7. eBook Manager and Catalogue App
    1. Setting up the project
    2. Virtual Storage Spaces and extension methods
      1. The DocumentEngine class
      2. The ImportBooks form
      3. Expression-bodied accessors, constructors, and finalizers
      4. Populating the TreeView control
      5. Local functions
      6. Pattern matching
      7. Finishing up the ImportBooks code
      8. Throw expressions
      9. Saving a selected book to a storage space
    3. Main eBookManager form
    4. Running the eBookManager application
    5. Summary
  8. Cricket Score Calculator and Tracker
    1. Setting up the project
    2. Object-oriented programming
      1. Abstraction
      2. Polymorphism
        1. Compile-time polymorphism versus run-time polymorphism
      3. Inheritance
      4. Encapsulation
        1. Encapsulation versus abstraction
    3. Classes in Cricket Score Tracker
      1. Abstract classes
      2. Interfaces 
      3. Classes
    4. Putting it all together
      1. SOLID design principles
        1. Single responsibility principle
        2. Open/closed principle
    5. Summary
  9. Cross Platform .NET Core System Info Manager
    1. Setting up the project on Windows
      1. The project in detail
      2. Climacons
      3. The Startup.cs file
      4. The InformationModel class
      5. The InformationController class
      6. The GetInfo view
    2. Running the application on macOS
    3. Setting up the app on Linux
    4. Summary
  10. Task Bug Logging ASP .NET Core MVC App
    1. What are the benefits of using MongoDB?
      1. Faster development with MongoDB
      2. Career–enhancing skillset
      3. MongoDB is ranked well in the industry
    2. Setting up MongoDB on your local machine
    3. Connecting your ASP.NET Core MVC application to MongoDB
      1. Adding the NuGet package
      2. Creating the MongoDbRepository class
    4. Reading and writing data to MongoDB
      1. Creating the interfaces and Work ItemService
      2. Creating the view
      3. Modifying the HomeController
      4. Adding work items
      5. Redirecting to the list of work items
    5. Summary
  11. ASP.NET SignalR Chat Application
    1. Project layout
    2. Setting up the project
    3. Adding the SignalR libraries
    4. Building the server
      1. SignalR Hub subclass
      2. Configuration changes
    5. Creating a client
      1. Included libraries
      2. Naming section
      3. Chat input
      4. Conversation panel
      5. Archive function
      6. JavaScript functions
    6. Solution overview
    7. Showing and telling
      1. Running the application
      2. Getting the party started
      3. Archiving the chat
    8. Summary
  12. Web Research Tool with Entity Framework Core
    1. Entity Framework (EF) Core history
      1. Enter Entity Framework
    2. Code-First versus Model-First versus Database-First approach
      1. Code-First approach
      2. Model-First approach
      3. Database-First approach
    3. Developing a database design
    4. Setting up the project
    5. Installing the required packages
      1. Entity Framework Core SQL Server
      2. Entity Framework Core tools
      3. Code generation design
        1. Creating the models
        2. Configuring the services
        3. Creating the database
        4. Seeding the database with test data
        5. Creating the controller
        6. Running the application
    6. Deploying the application
      1. Microsoft Azure App Service
      2. Custom targets
        1. FTP
        2. Web Deploy
        3. Web Deploy Package
        4. File System
      3. Folder
      4. Import Profile
    7. Summary
  13. A Serverless Email Validation Azure Function
    1. Beginning with serverless computing
      1. Importance of serverless computing
    2. Features of Azure Functions
      1. Choice of languages
      2. Pay-per-use pricing
      3. Flexible development
    3. What types of Azure Functions can I create?
    4. Creating an Azure Function
    5. Modifying the Azure Function code
    6. Calling an Azure Function from an ASP.NET Core MVC application
      1. Creating the login form
      2. Hooking it all up
    7. Summary
  14. Twitter Clone Using OAuth
    1. Using Tweetinvi
      1. The ASP.NET Core MVC Twitter clone application
      2. Creating your application on Twitter
      3. Creating the ASP.NET Core MVC Application and adding the NuGet package
    2. Let's code
      1. Setting up the classes and settings
      2. Creating the TweetItem class
      3. Setting up the CSS
      4. Adding the controllers
      5. Creating views
      6. Modifying HomeController
      7. Creating the TwitterViewModel class
      8. Creating the HomeTimeline view
      9. Modifying the TwitterController class
      10. Finishing up—the ComposeTweet view
    3. Running the CoreTwitter application
    4. Summary
  15. Using Docker and ASP.NET Core
    1. What is Docker?
      1. Images and containers
      2. Where does Docker run?
      3. How Docker benefits web developers
    2. Installing Docker on Windows 10 Pro
      1. Understanding Docker
      2. Running an ASP.NET Core application from Visual Studio 2017 inside Docker
      3. Adding Docker support to an existing ASP.NET Core application
      4. Using Docker Hub with GitHub
    3. Summary
  16. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think