How do I pull a value from user-secrets for use in a dotnet command?
The best I can do at the moment is:
$c = dotnet user-secrets list
Shows me: AppSettings:MyConnectionString = "Value of the connection string"
$c.GetType() //tells me BaseType = System.Object, Name = String, etc.
Now I can potentially try to extract the value of the connection string but that doesn't seem like a good way to do it.
I want to use the user-secret in the command:
dotnet ef dbcontext scaffold <MyConnectionString> Microsoft.EntityFrameworkCore.SqlServer -o Models
If I enter it in manually, then the database credentials will be stored in the command line history and I will get a warning in Visual Studio about how to protect potentially sensitive information by including it in my configuration file. However, I want to use user-secrets for development rather than adding the connection string to my configuration file.