Я пытаюсь создать свой DB-Context для моего приложения Net Core.
Я использую следующую команду, потому что "Scaffold-DbContext" не известен. Я уверен, что я уже сделал это с этой командой на другом компьютере.
dotnet ef dbcontext scaffold "Строка подключения" Npgsql.EntityFrameworkCore.PostgreSQL -o Models_Server --verbose
Что такое службы времени разработки и как я могу их получить?
подробный вывод:
...
Finding design-time services for provider 'Npgsql.EntityFrameworkCore.PostgreSQL'...
Using design-time services from provider 'Npgsql.EntityFrameworkCore.PostgreSQL'.
Finding design-time services referenced by assembly 'ib.api_core'.
No referenced design-time services were found.
Finding IDesignTimeServices implementations in assembly 'ib.api_core'...
No design-time services were found.
ОШИБКА:
System.TimeoutException: The operation has timed out.
at Npgsql.NpgsqlConnector.Connect(NpgsqlTimeout timeout) in C:\projects\npgsql\src\Npgsql\NpgsqlConnector.cs:line 703
at Npgsql.NpgsqlConnector.RawOpen(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) in C:\projects\npgsql\src\Npgsql\NpgsqlConnector.cs:line 555
cts\npgsql\src\Npgsql\NpgsqlConnector.cs:line 414
at Npgsql.ConnectorPool.AllocateLong(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) in C:\projects\npgsql\src\Npgsql\ConnectorPool.cs:line 246
at Npgsql.NpgsqlConnection.<>c__DisplayClass32_0.<<Open>g__OpenLong|0>d.MoveNext() in C:\projects\npgsql\src\Npgsql\NpgsqlConnection.cs:line 301
--- End of stack trace from previous location where exception was thrown ---
at Npgsql.NpgsqlConnection.Open() in C:\projects\npgsql\src\Npgsql\NpgsqlConnection.cs:line 153
at Npgsql.EntityFrameworkCore.PostgreSQL.Scaffolding.Internal.NpgsqlDatabaseModelFactory.Create(DbConnection dbConnection, IEnumerable`1 tables, IEnumerable`1 schemas) in C:\projects\npgsql-entityframeworkcore-postgresql\src\EFCore.PG\Scaffolding\Internal\NpgsqlDatabaseModelFactory.cs:line 102
at Npgsql.EntityFrameworkCore.PostgreSQL.Scaffolding.Internal.NpgsqlDatabaseModelFactory.Create(String connectionString, IEnumerable`1 tables, IEnumerable`1 schemas) in C:\projects\npgsql-entityframeworkcore-postgresql\src\EFCore.PG\Scaffolding\Internal\NpgsqlDatabaseModelFactory.cs:line 86
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, IEnumerable`1 tables, IEnumerable`1 schemas, String namespace, String language, String contextDir, String contextName, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions)
at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String outputDbContextDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_1.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
The operation has timed out.
.csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<DockerDefaultTargetOS>Windows</DockerDefaultTargetOS>
<UserSecretsId>5a596668-4322-425e-a721-a9f91d12308c</UserSecretsId>
<ApplicationIcon />
<OutputType>Exe</OutputType>
<StartupObject></StartupObject>
<Platforms>AnyCPU;x86;x64</Platforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PlatformTarget>x64</PlatformTarget>
<Optimize>false</Optimize>
<Prefer32Bit>false</Prefer32Bit>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
<Optimize>false</Optimize>
<Prefer32Bit>false</Prefer32Bit>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<PlatformTarget>x64</PlatformTarget>
<Optimize>false</Optimize>
<Prefer32Bit>false</Prefer32Bit>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Controllers\ServerConnector\Common\**" />
<Compile Remove="Controllers\ServerConnector\Communication\**" />
<Compile Remove="Controllers\ServerConnector\Extensions\**" />
<Content Remove="Controllers\ServerConnector\Common\**" />
<Content Remove="Controllers\ServerConnector\Communication\**" />
<Content Remove="Controllers\ServerConnector\Extensions\**" />
<EmbeddedResource Remove="Controllers\ServerConnector\Common\**" />
<EmbeddedResource Remove="Controllers\ServerConnector\Communication\**" />
<EmbeddedResource Remove="Controllers\ServerConnector\Extensions\**" />
<None Remove="Controllers\ServerConnector\Common\**" />
<None Remove="Controllers\ServerConnector\Communication\**" />
<None Remove="Controllers\ServerConnector\Extensions\**" />
<Compile Remove="Controllers\ServerConnector\IbServerConnector.cs" />
<Compile Remove="Controllers\ServerConnector\IbItemCreator.cs" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Controllers\ServerConnector\lib\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="2.0.0-preview1-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.5" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.2.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="AutoMapper">
<HintPath>Controllers\ServerConnector\lib\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="IB.Common.ClassLibrary">
<HintPath>Controllers\ServerConnector\bin\IB.Common.ClassLibrary.dll</HintPath>
</Reference>
<Reference Include="IB.Common.Components">
<HintPath>Controllers\ServerConnector\bin\IB.Common.Components.dll</HintPath>
</Reference>
<Reference Include="IB.Common.Extensions">
<HintPath>Controllers\ServerConnector\bin\IB.Common.Extensions.dll</HintPath>
</Reference>
<Reference Include="IB.Communication.Client">
<HintPath>Controllers\ServerConnector\bin\IB.Communication.Client.dll</HintPath>
</Reference>
<Reference Include="IB.Communication.Common">
<HintPath>Controllers\ServerConnector\bin\IB.Communication.Common.dll</HintPath>
</Reference>
<Reference Include="IB.Communication.Interfaces">
<HintPath>Controllers\ServerConnector\bin\IB.Communication.Interfaces.dll</HintPath>
</Reference>
<Reference Include="System.Configuration">
<HintPath>Libraries\System.configuration.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="Controllers\ServerConnector\Common\ClassLibrary\app.config" />
<_ContentIncludedByDefault Remove="Controllers\ServerConnector\Common\GuiUtil\app.config" />
<_ContentIncludedByDefault Remove="Controllers\ServerConnector\Common\HbnManager\app.config" />
<_ContentIncludedByDefault Remove="Controllers\ServerConnector\Communication\ClientApp\App.config" />
<_ContentIncludedByDefault Remove="Controllers\ServerConnector\Communication\Client\packages.config" />
<_ContentIncludedByDefault Remove="Controllers\ServerConnector\Communication\ServerApp\App.config" />
<_ContentIncludedByDefault Remove="Controllers\ServerConnector\Common\Components\obj\IB.Common.Components.csproj.nuget.dgspec.json" />
<_ContentIncludedByDefault Remove="Controllers\ServerConnector\Common\Components\obj\project.assets.json" />
</ItemGroup>
</Project>