I use the following command to generate the C# (.NET Core 3.1) files from a SQL Server DB (SQL Server 2016):
dotnet ef dbcontext scaffold $ConnectionString Microsoft.EntityFrameworkCore.SqlServer --no-build --no-onconfiguring -f -c "MyContext" -o Table1/DataAccess -t dbo.Table1
When I run this in Powershell 5.1, the files are encoded in UTF-8
.
But when I use Powershell Core 7.1.0, the files are encoded in Western European (Windows)
.
I don't think the dotnet ef
tool uses the default encoding of Powershell, because the output of $OutputEncoding
is US-ASCII
for powershell 5.1 and UTF-8
for Powershell Core 7.1.0.
I would like to use the dotnet ef
CLI in Powershell Core 7.1.0 to generate UTF-8 encoded files. How can I do this?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…