fullstackhero / dotnet-starter-kit

Production Grade Cloud-Ready .NET 8 Starter Kit (Web API + Blazor Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.
https://fullstackhero.net/dotnet-webapi-boilerplate/
MIT License
5.3k stars 1.58k forks source link

Error while creating migrations #1003

Closed Hadi69ans closed 3 months ago

Hadi69ans commented 3 months ago

The problem is that we encounter this error when creating a new migrations using the following commands.

dotnet ef migrations add "Add Identity Schema" --project ../src/api/migrations/MSSQL/ --context IdentityDbContext -o Identity dotnet ef migrations add "Add Tenant Schema" --project ../src/api/migrations/MSSQL/ --context TenantDbContext -o Tenant dotnet ef migrations add "Add Todo Schema" --project ../src/api/migrations/MSSQL/ --context TodoDbContext -o Todo dotnet ef migrations add "Add Catalog Schema" --project ../src/api/migrations/MSSQL/ --context CatalogDbContext -o Catalog

Unable to create a 'DbContext' of type 'TodoDbContext'. The exception 'Unable to resolve service for type 'Finbuckle.MultiTenant.Abstractions.IMultiTenantContextAccessor`1[Ham30.Framework.Infrastructure.Tenant.Ham30TenantInfo]' while attempting to activate 'Ham30.WebApi.Todo.Persistence.TodoDbContext'.' was thrown while attempting to create an instance. For the different patterns supported at design time

image

Hadi69ans commented 3 months ago

@iammukeshm Engineer, is this problem from my implementation or a bug in the project? I try every method, it gives me an error I have created many modules but I got error while creating Migration I even re-downloaded the raw version of the project again, but this message is displayed when creating the migration.

iammukeshm commented 3 months ago

image

I dont see a problem with it. Are you running the migration command from the correct location?

Hadi69ans commented 3 months ago

Yes, it looks like I ran the commands in the wrong place Thank you very much for your guidance My problem is solved image