AaronSadlerUK
03/01/2024, 7:53 PMservices.AddUmbracoDbContext<TicketsContext>((serviceProvider, options) =>
{
options.UseUmbracoDatabaseProvider(serviceProvider);
});
However when I run the site I get the following error:
Unable to create a 'DbContext' of type 'TicketsContext'. The exception 'Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`1[UmbTickets.DAL.DbContexts.Tickets.TicketsContext]' while attempting to activate 'UmbTickets.DAL.DbContexts.Tickets.TicketsContext'.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
https://docs.umbraco.com/umbraco-cms/tutorials/getting-started-with-entity-framework-core#step-2-create-dbcontext-classDennis Pedersen
03/01/2024, 8:16 PMDennis Pedersen
03/01/2024, 8:16 PMDennis Pedersen
03/01/2024, 8:17 PMLiam
03/07/2024, 4:47 PMdotnet ef migrations add
command?
If you use the command, you should be able to specify the migrated project, like
dotnet ef migrations add --context TicketsContext --project .\path\to\your\DbContext.csproj
AaronSadlerUK
03/07/2024, 5:06 PMAaronSadlerUK
03/20/2024, 7:04 PMJemayn
03/21/2024, 9:18 AMLiam
03/21/2024, 10:43 AM-> \MyUmbracoSln
------> \MyUmbracoSln.Umbraco.Site // contains the front-end
------> \MyUmbracoSln.Umbraco.Core
------> \MyUmbracoSln.Database // contains the EF Contexts
My steps go:
cd .\MyUmbracoSln.Umbraco.Site
Then :
dotnet ef migrations add InitialCreate --context MyEntityContext -o .\Generated\ --project ..\MyUmbracoSln.Database\MyUmbracoSln.Database.csproj
Jemayn
03/21/2024, 11:20 AM-s
option with a path to the website project insteadLiam
03/21/2024, 12:05 PM-s
option