Open roji opened 2 years ago
I think it would be better to set the timeouts to be 0 (indefinite wait) so that way it works for everyone out of the box without needing to add a command line option to dotnet-ef.
However I would take it a step further and also optimize the generated sql that is used for scaffold as well.
Why? Because I feel that dotnet-ef has plenty of options already that a developer must keep track of, why add 1 more?
If there is a need for this in certain environments it should be managed via the connection string IMHO
I tried it via ;Connection Timeout=0
it did not change the issue where scaffolding would still time out.
And ironically it's doing it for a db with only 9 tables.
Edit: looks like it was ;Command Timeout=0
😃
You should be using Command Timeout and a newer version of Microsoft.Data.SqlClient. If that does not work I suggest you create a new issue with the full error message.
I use the version of SqlClient from 7.0.0-preview7 of efcore when scaffolding (Debug), but use 6.0.8 of efcore at runtime (Release).
Although I did fix that and I now run into this:
System.IO.FileNotFoundException: Could not load file or assembly 'Humanizer, Version=2.14.0.0, Culture=neutral, PublicKeyToken=979442b78dfc278e'. The system cannot find the file specified.
File name: 'Humanizer, Version=2.14.0.0, Culture=neutral, PublicKeyToken=979442b78dfc278e'
at Microsoft.EntityFrameworkCore.Design.Internal.HumanizerPluralizer.Singularize(String name)
I see that preview7 should be using 2.14.1 of humanizer however for some reason when scaffolding it wants to look for 2.14.0.
Looks like you are mixing dependencies. Won't work .
Looks like you are mixing dependencies. Won't work .
Except when scaffolding I have only these dependencies:
<PackageReference Include="IDisposableAnalyzers" Version="*-*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="StrongNamer" Version="*-*" />
<!-- So building works with scaffold. -->
<PackageReference Include="AraHaan.EntityFrameworkCore.Plugins" Version="*-*" />
<PackageReference Include="CsvHelper" Version="28.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0-preview.7.22376.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-preview.7.22376.2" />
<!-- We need to include the package version when scaffolding. This is to ensure building during scaffold works. -->
<PackageReference Include="Remora.Discord" Version="*-*" />
<!-- Ensure 6.0.0+ versions of these are referenced over the 4.7.2 version. -->
<PackageReference Include="System.Runtime.Caching" Version="*-*" />
<PackageReference Include="System.Security.Cryptography.Cng" Version="*" />
I tested it by removing the need to consume all of the non-efcore packages when scaffolding and discovered that it's still having the same issue (by removing all **/*.cs
files from the compilation when scaffolding).
Add a command-line option which controls the ADO.NET timeouts. This would allow users to set a higher timeout for e.g. migrations without needing to manage multiple connection strings.
We could probably have a single cmdline option to manage both the connection and command timeouts.
Raised in https://github.com/dotnet/efcore/issues/27783#issuecomment-1105585740 and also discussed in #22287.