Introduction:

In this we will learn how to update Entity Framework (EF) Core from database in mvc core using package manager console visual studio 2017 and what is Entity Framework (EF) Core.

Description:

Here we are going to achieve how to update  Entity Framework (EF) Core from database in mvc core using package manager console visual studio 2017. 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 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:

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

Studio by right clicking on your database. For this example, the 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  model  DBContext.
  •  
  • I hope it will help to you.

0 comments


Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

You may also like