Home > Blockchain >  How to create database first approach exact class project
How to create database first approach exact class project

Time:06-14

I just doing a simple CRUD operation using database first approach. I have an ASP.NET MVC project and another a class library project.

I already mentioned ManageEmployee.Management is a class library project, and ManageEmployee.Web is the ASP.NET MVC web project.

Scaffold-DbContext -Connection "Server=MCH-DESKTOP\SQLEXPRESS; Database=AutoSoftSystems; Trusted_Connection=True; MultipleActiveResultSets=true;" 
                   -Provider Microsoft.EntityFrameworkCore.SqlServer 
                   -OutputDir "Models" 
                   -ContextDir "Data" -Context "EmployeeDbContext"

Running this command on the Package Manager console works fine, but the file is generated in the web project.

I want to change path direction. How can I change my path to the ManageEmployee.Management folder?

CodePudding user response:

Your Default project in Package Manager console is ManageEmployee.Web, you should change that to ManageEmployee.Management and your EmoloyeeDBContext need to be in ManageEmployee.Management also - then you run command to generate models.

Btw I'm pretty sure that if you say that your -OutputDir "../ManageEmployee.Management/Models" that should work also. I have never tried this last part but I think that is worth a try.

CodePudding user response:

I am highly recommended to use enter image description here

  • Related