How to scaffold-dbcontext in different folders?

We can run the following command, which will create the context and models in the project:

Scaffold-DbContext -Connection "Data Source=somedatasource.com;Initial Catalog=mydb;Integrated Security=False;User Id=user;Password=pass;MultipleActiveResultSets=True" -Provider Microsoft.EntityFrameworkCore.SqlServer -Tables PrdSalesRegion -Context SalesRegionContext

How to specify different output folders for context and tables?

When I try to do this:

Scaffold-DbContext -Connection "Data Source=somedatasource.com;Initial Catalog=mydb;Integrated Security=False;User Id=user;Password=pass;MultipleActiveResultSets=True" -Provider Microsoft.EntityFrameworkCore.SqlServer -Tables Models/PrdSalesRegion -Context Context/SalesRegionContext

Please note that the only change:

-Tables Models/PrdSalesRegion -Context Context/SalesRegionContext

Then I get this output:

The context class name passed in to Context / SalesRegionContext is not a valid C # identifier.

How to specify different output folders for context and tables?

+4
source share
1 answer

-o <DIR>, . , -f , .

:

Scaffold-DbContext "Host=127.0.0.1;Database=dbname;Username=postgres;Password=test12345"Npgsql.EntityFrameworkCore.PostgreSQL -o Entities -f

,

+1

Source: https://habr.com/ru/post/1688826/


All Articles