Chad, Project, LoggerC03, Migration
LoggerC01 EF - tag
https://ask.chadgpt.ru/share/8e69d16f-7e85-44a5-bc43-8594e9869c9b
D:\VC25\gs.trade.core\Logger\Logger.sln
D:\VC25\gs.trade.core\Logger\LoggerLib\LoggerLib.csproj
D:\VC25\gs.trade.core\Logger\CaLogger01\CaLogger01.csproj
ConnectionString:
"Server=WIN-0EMQO515V3S\\SQLDVLP25;Database=LoggerC03;Trusted_Connection=True; Trust Server Certificate = True;"
Need to Install
CaLogger01 and LoggerLib
Microsoft.EntityFrameworkCore.Design
Migrations: CaLogger01
PM> Add-Migration Initial
Build started...
Build failed.
PM> dotnet ef migrations add InitialCreate --project LoggerLib --startup-project CaLogger01
Build started...
Build succeeded.
Your startup project 'CaLogger01' doesn't reference Microsoft.EntityFrameworkCore.Design. This package is required for the Entity Framework Core Tools to work. Ensure your startup project is correct, install the package, and try again.
PM> dotnet ef migrations add InitialCreate --project LoggerLib --startup-project CaLogger01
Build started...
Build succeeded.
Unable to create a 'DbContext' of type 'RuntimeType'. The exception 'Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`1[LoggerLib.LoggerDbContext]' while attempting to activate 'LoggerLib.LoggerDbContext'.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
PM> dotnet ef migrations add InitialCreate --project LoggerLib --startup-project CaLogger01
Build started...
Build succeeded.
Done. To undo this action, use 'ef migrations remove'
PM> dotnet ef database update --project LoggerLib --startup-project CaLogger01
Build started...
Build succeeded.
Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
PM> dotnet ef database update --project LoggerLib --startup-project CaLogger01
Build started...
Build succeeded.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
PM> dotnet ef database update --project LoggerLib --startup-project CaLogger01
Build started...
Build succeeded.
Acquiring an exclusive lock for migration application. See https://aka.ms/efcore-docs-migrations-lock for more information if this takes too long.
Applying migration '20250530005634_InitialCreate'.
Done.
PM>
Комментариев нет:
Отправить комментарий