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
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
C# 7 and .NET Core 2.0 Blueprints

You're reading from   C# 7 and .NET Core 2.0 Blueprints Build effective applications that meet modern software requirements

Arrow left icon
Product type Paperback
Published in Mar 2018
Publisher
ISBN-13 9781788396196
Length 428 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Dirk Strauss Dirk Strauss
Author Profile Icon Dirk Strauss
Dirk Strauss
Jas Rademeyer Jas Rademeyer
Author Profile Icon Jas Rademeyer
Jas Rademeyer
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. eBook Manager and Catalogue App FREE CHAPTER 2. Cricket Score Calculator and Tracker 3. Cross Platform .NET Core System Info Manager 4. Task Bug Logging ASP .NET Core MVC App 5. ASP.NET SignalR Chat Application 6. Web Research Tool with Entity Framework Core 7. A Serverless Email Validation Azure Function 8. Twitter Clone Using OAuth 9. Using Docker and ASP.NET Core 10. Other Books You May Enjoy

Reading and writing data to MongoDB

In this section, we will have a look at how to read a list of work items from the MongoDB database and also how to insert a new work item into the database. I call them work items, because a work item can be a task or a bug. This can be done by performing the following steps:

  1. In the Models folder, create a new class called WorkItem, as shown in the following screenshot:
  1. Add the following code to the WorkItem class. You will notice that Id is of type ObjectId. This represents the unique identifier in the MondoDB document that gets created.
You need to ensure that you add the following using statement to your WorkItem class using MongoDB.Bson;.

Take a look the following code:

public class WorkItem 
{ 
    public ObjectId Id { get; set; } 
    public string Title { get; set; } 
    public string Description { get; set; } 
    public int Severity...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image