---
title: "update dbcontext from database using entity framework core in asp.net mvc core"  
description: "In this we will learn how to update Entity Framework (EF) Core from database in asp.nrtmvc core using package manager console visual studio 2019 and w"  
author: "Anonymous User"  
published: 2020-12-01  
updated: 2020-12-01  
canonical: https://www.mindstick.com/articles/324875/update-dbcontext-from-database-using-entity-framework-core-in-asp-dot-net-mvc-core  
category: ".net"  
tags: [".net core"]  
reading_time: 2 minutes  

---

# update dbcontext from database using entity framework core in asp.net mvc core

## Introduction:

In this we will explain how to update [Entity Framework](https://www.mindstick.com/forum/12875/how-to-use-object-query-with-a-where-and-to-retrieve-entity-record-entity-framework) (EF) Core from [database in asp.net](https://answers.mindstick.com/qa/94215/how-to-create-xml-file-automatically-when-any-new-record-is-inserted-in-database-in-asp-dot-net-mvc-also-delete-and-update-that-xml-file-base-on-record) mvc core using [package manager](https://answers.mindstick.com/qa/112022/what-are-the-advantages-of-using-a-package-manager-like-npm-or-yarn-in-javascript-development) console [visual studio](https://www.mindstick.com/forum/12863/how-to-insert-a-video-in-asp-dot-net-web-page-in-visual-studio-2010) 2019 and what is Entity Framework (EF) Core.

## Description:

Here we are going to achieve how to [update Entity](https://answers.mindstick.com/qa/44325/how-to-update-entity-framework-in-asp-net-core) Framework (EF) Core from database in mvc core using package manager console visual studio 2019. Before starting let’s know what is Entity Framework (EF) Core.

Entity Framework (EF) Core is a lightweight, extensible, and cross-platform version of the popular Entity Framework [data access](https://www.mindstick.com/blog/301551/risks-and-challenges-of-data-access-and-sharing) technology. EF Core is an object-relational mapper (O/RM) that enables .NET developers to work with a database using .NET objects.

To get more information about EF Core, I would recommend you to visit the official documentation here: https://docs.microsoft.com/en-us/ef/core/

Let’s start Update Entity Framework (EF) Core from database.

**Goto > Tools >** library package manager> package manager console > click .

**Now open a window in bottom of screen then type following [command line](https://www.mindstick.com/interview/477/how-can-i-execute-a-php-script-using-command-line):**

```
Scaffold-DbContext "Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=collage;Data Source=(local)"
Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -force
```

The **Data Source** attribute above is the SQL server instance name. You can find it in [SQL Management](https://www.mindstick.com/forum/159668/what-is-the-difference-between-sql-server-and-sql-management-studio)

Studio by right clicking on your database. For this example, the [server name](https://answers.mindstick.com/qa/110129/how-to-change-discord-server-name) is “SSAI-L005\SQLEXPRESS”.

The **Database** attribute is your database name. In this case, the database name is “Collage”.

The **–OutputDir** attribute allows you to specify the location of the files generated. In this case, we’ve set it

to Models.

The **-force** attribute use to [update your](https://answers.mindstick.com/qa/96426/how-can-you-update-your-profile-without-notifying-contacts) model DBContext.

I hope it will help to you.

---

Original Source: https://www.mindstick.com/articles/324875/update-dbcontext-from-database-using-entity-framework-core-in-asp-dot-net-mvc-core

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
