dotnet / dotnet/docs

EFCore Scaffold-DbContext unclear about OutputDir

Open
#39,771 0 comments 0 reactions 0 assignees View on GitHub
:watch: Not Triaged
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

### Describe the issue or suggestion

In [this](https://learn.microsoft.com/en-us/ef/core/cli/powershell#scaffold-dbcontext) article, the description for OutputDir says "The directory to put entity class files in.". However, if you don't also pass the ContextDir parameter (or pass it as an empty string), the dbcontext file gets put in this directory as well.
It would be nice if the description could be updated to be more clear about this behaviour.
I found [this](https://learn.microsoft.com/en-us/ef/core/managing-schemas/scaffolding/?tabs=vs#target-directories-and-namespaces) article as well which describes it a bit better: "You can specify the directory where classes are scaffolded using -OutputDir, and -ContextDir can be used to scaffold the DbContext class into a separate directory from the entity type classes".

---
#### Document Details

⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*

* ID: 4dde2676-6cc2-daeb-c3e8-e2c4f4c6517c
* Version Independent ID: c5341d6b-fff6-d42b-2ccc-6a28c39f19a0
* Content: [EF Core tools reference (Package Manager Console) - EF Core](https://learn.microsoft.com/en-us/ef/core/cli/powershell#scaffold-dbcontext)
* Content Source: [entity-framework/core/cli/powershell.md](https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/cli/powershell.md)
* Service: **entity-framework**
* Sub-service: **entity-framework-core**
* GitHub Login: @bricelam
* Microsoft Alias: **avickers**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.