2
我正在創建一個應用程序,它使用dotnet ef dbcontext scaffold
命令從數據庫創建模型。雖然它很好用,但我想知道是否可以更改自動使用的名稱空間。我使用的是這樣的:是否可以更改腳手架命名空間?
var process = new Process
{
StartInfo = new ProcessStartInfo
{
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "dotnet",
Arguments = $"ef dbcontext scaffold \"{connectionString}\" Microsoft.EntityFrameworkCore.SqlServer -d -c {contextName} -o \"{outputPath}\" -f",
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
WorkingDirectory = workingDirectory
}
};
process.Start();
The MSDN article似乎沒有列出此選項,但有可能是一個未公開的方式:
選項:
- - d | --data-annotations
- -c | --context
- -f | --force
- -o | --output-dir的
- --schema ...
- -t | --table ...
- --use-數據庫名稱
- --json
- -p | - 項目
- -s | --startup項目
- --framework
- --configuration
- --runtime
- --msbuildprojectextensionspath
- --no-建立
- -h | --help
- -v | --verbose
- --no色
- --prefix輸出
是的,我知道,我想改變它,以便它不使用項目的名稱空間。實際上,我將完整路徑(包括驅動器號)傳遞給'-o'參數 –