Reputation: 81
I'm trying to scaffold Models from an existing database.
Scaffold-DbContext "connectionString" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
But I got this error:
Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Any ideas?
Upvotes: 2
Views: 1832
Reputation: 3894
For me, it worked with SQL Server 2019 (15) by adding Command Timeout=300
to the Connection String.
Upvotes: 3
Reputation: 51
As far as I know there is no solution at the moment.
The SQL Server connection string does not allow to define the command timeout, but only the connection timeout.
I solved it using the --schema dbo
option, which eliminated a dozen tables that have another schema, and now it works.
But for how long?
My code:
dotnet ef dbcontext scaffold "SERVER=.;DATABASE=dbstore0;Integrated Security=SSPI;Connection Timeout=300;TrustServerCertificate=True" Microsoft.EntityFrameworkCore.SqlServer -f -o DbStore\Models --context-dir DbStore\Contexts -c DbStoreContext -p Store.Domain.csproj --no-pluralize --schema dbo
Upvotes: 2