C#C
C#2y ago
oke

Trying to setup SQLite with EntityFramework (Discord Bot /w DSharpPlus)

I'm trying to setup SQLite for my discord bot, and to start the DB file, I tried using this command
PM> Add-Migration InitialCreate -Context LloydWarningSystem.Net.Entities.LloydContext


LloydContext is my class that inherits DbContext. However, this command just builds my bot then runs it then gives an exception saying it cant find my service.

PM> Add-Migration InitialCreate -Context LloydWarningSystem.Net.Entities.LloydContext
Both Entity Framework Core and Entity Framework 6 are installed. The Entity Framework Core tools are running. Use 'EntityFramework6\Add-Migration' for Entity Framework 6.
Build started...
Build succeeded.
[!]    Bot start @ 7/21/2024 2:46:06 PM (Debug build)
[2024-07-21 20:46:08 +00:00] [DSharpPlus.DiscordClient] [Info]  DSharpPlus; version 5.0.0-nightly-02329+a9fe1468a51cabd82565a7f7e86d86ce1c428595
[!]    Bot ready for commands.
An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Timed out waiting for the entry point to build the IHost after 00:05:00. This timeout can be modified using the 'DOTNET_HOST_FACTORY_RESOLVER_DEFAULT_TIMEOUT_IN_SECONDS' environment variable.
Unable to create a 'DbContext' of type 'LloydWarningSystem.Net.Entities.LloydContext'. The exception 'Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`1[LloydWarningSystem.Net.Entities.LloydContext]' while attempting to activate 'LloydWarningSystem.Net.Entities.LloydContext'.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
Was this page helpful?