-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for using response files from EF commands #10409
Comments
Should be as simple as setting |
Hi, Before I get started with this (I've no development experience with EF Core it self, so probably some stupid questions initially) I have some questions
My thought is that the response file just acts as a argument container for the given context. We have If no context is specified when excuting the command then the default file must start with (or contain) the argument -c. Additional parameters are appended to the command as expected and if a parameter is specified twice then the explicit parameter takes precedence over the parameter defined in the file.
|
Response files are a general feature of the command-line argument parser. We'd simply turn it on for the The feature lets you read command-line arguments from a file. For example, if ECHO @message.txt
|
@bricelam this is a feature that i would find useful and so i have had a go with the changes and it works as you explained. do you have any guidance on unit testing? For me I created a project and at the command line ran something like dotnet ./dotnet-ef.dll migrations list @BloggingContext.ef.config. Because the entry point is calling the command line, I am unsure on your preferred approach as to how to achieve this in an automated way (is there an expectation for automated testing at the command line level)? Or is it sufficient for the entry point to just test CommandLineApplication::ExpandResponseFiles(). If you do have any further thoughts and/or guidance on how to approach the unit testing that would be appreciated. |
I think we can sort out adding automated tests as part of #9111. If you've manually verified it all works, go ahead and submit the PR. |
- Enable response files at command line Manual tests include: 1. dotnet ./dotnet-ef.dll migrations add initial @BloggingContext.ef.config (BloggingContext.ef.config contents) -p C:\playground\AppToBuilder\AppToBuilder.csproj -s C:\playground\AppToBuilder\AppToBuilder.csproj 2. dotnet ./dotnet-ef.dll @BloggingContext.ef.config (BloggingContext.ef.config contents) migrations add initial -p C:\playground\AppToBuilder\AppToBuilder.csproj -s C:\playground\AppToBuilder\AppToBuilder.csproj 3. dotnet ./dotnet-ef.dll migrations add initial @d:/BloggingContext.ef.config (relative path) 4. dotnet ./dotnet-ef.dll migrations add @d:/BloggingContext.ef.config (error condition, results in Missing required argument '<NAME>'.) Fixes #10409
For those waiting and want a temporary solution here is what I've used mean while Add-Migration@echo off
set /p args=<%2
pushd %~dp0src\WebApp
echo on
dotnet ef migrations add %1 %2
@echo off
popd %~dp0 Similarly for |
To make something like this work:
dotnet ef migrations add @MyContext.ef.config
The text was updated successfully, but these errors were encountered: