C# 7 and .NET Core 2.0 Blueprints
eBook - ePub

C# 7 and .NET Core 2.0 Blueprints

  1. 428 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

C# 7 and .NET Core 2.0 Blueprints

About this book

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

Key Features

  • 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

Book 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.

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

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.

Trusted by 375,005 students

Access to over 1.5 million titles for a fair monthly price.

Study more efficiently using our study tools.

Information

Year
2018
Print ISBN
9781788396196
Edition
1
eBook ISBN
9781788398138

Web Research Tool with Entity Framework Core

"The biggest lie I tell myself is that I don't need to write it down, I'll remember it."
– Unknown
So, you've got a few minutes to catch up on your feeds. As you scroll through, you come across a link to an article that someone shared about new ways to remember your guitar chords. You really want to read it, but you don't have enough time now. "I'll read it later", you tell yourself, and later becomes never. Mainly because you did not write it down.
Now there are various applications out there that cater for your need to save links for later use. But we're developers. Let's just have some fun writing our own.
In this chapter, we will look at the following:
  • Entity Framework (EF) Core history
  • Code-First versus Model-First versus Database-First approach
  • Developing a database design
  • Setting up the project
  • Installing EF Core
  • Creating the models
  • Configuring the services
  • Creating the database
  • Seeding the database with test data
  • Creating the controller
  • Running the application
  • Deploying the application
That is quite a mouthful, but don't fret, we'll take it one step at a time. Let's take a walk.

Entity Framework (EF) Core history

One of the most frustrating parts of developing an application that needs to read data from and write data to some sort of database, is trying to get the communication layer between your code and the database established.
At least, it used to be.

Enter Entity Framework

Entity Framework is an object-relational mapper (ORM). It maps your .NET code objects to relational database entities. As simple as that. Now, you don't have to concern yourself with scaffolding the required data-access code just to handle plain CRUD operations.
When the first version of Entity Framework was released with .NET 3.5 SP1 in August 2008, the initial response wasn't that great, so much so that a group of developers signed a vote of no confidence with regards to the framework. Thankfully, most of the raised concerns were addressed and the release of Entity Framework 4.0, together with .NET 4.0, put to bed a lot of the criticisms around the stability of the framework.
Microsoft then decided to take .NET cross-platform with .NET Core, which meant that Entity Framework Core was a complete rewrite. This obviously has its pros and cons as a comparison between EF Core and EF6 reveals that, while EF Core introduces new features and improvements, it remains a new code base and thus does not yet have all the features available in EF6.

Code-First versus Model-First versus Database-First approach

With Entity Framework, you can choose between three approaches of implementation, and it's always nice to have a choice. Let's have a quick look at the differences between them.

Code-First approach

The weapon of choice for hardcore programmers, this approach gives you full control over the database, from code. The database is seen a simple storage location and will most likely not contain any logic or business rules. Everything is driven from the code and thus any changes required need to be done in code as well:

Model-First approach

If you prefer painting over poetry, then you might prefer the Model-First approach. In this approach, you create or draw your model, and the workflow will generate a database script. You could also extend your model with partial classes, if there is a need to add specific logic or business rules, but it could become hairy and it might be better to consider the Code-First approach if there are too many specifics:

Database-First approach

The Database-First approach works well for large projects where you have a dedicated DBA designing and maintaining your database. Entity Framework will create your entities for you from the database design and you can run model updates whenever database changes are done:

Developing a database design

We can't know what we're doing until we know what we're doing. Before we jump in and create a Solution with our database, models, and controllers, we need to first figure out how we want to design the database.
According to Microsoft's TechNet, there are five basic steps one could follow to plan a database:
  1. Gather information
  2. Identify the objects
  3. Model the objects
  4. Identify the types of information for each object
  5. Identify the relationship between objects
Our requirement is pretty simple. We only need to save a web link to navigate to later, so we won't have multiple objects with relationships between them.
We do, however, need to clarify the types of information we'd like to save for our object (web link). Obviously, we need the URL, but what else do we need? M...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. Dedication
  4. Packt Upsell
  5. Contributors
  6. Preface
  7. eBook Manager and Catalogue App
  8. Cricket Score Calculator and Tracker
  9. Cross Platform .NET Core System Info Manager
  10. Task Bug Logging ASP .NET Core MVC App
  11. ASP.NET SignalR Chat Application
  12. Web Research Tool with Entity Framework Core
  13. A Serverless Email Validation Azure Function
  14. Twitter Clone Using OAuth
  15. Using Docker and ASP.NET Core
  16. Other Books You May Enjoy

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.5M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1.5 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access C# 7 and .NET Core 2.0 Blueprints by Dirk Strauss, Jas Rademeyer in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming. We have over 1.5 million books available in our catalogue for you to explore.