- 1402/05/01
- 0
- 64
1402/05/01
|
backend
مشکل در Add-Migration با دو تا DbContext
سلام در پروژه پایانی کلیپ 212 وقتی identity رو اضافه میکنیم در کلاس Program.cs وقتی Context جدید مربوط به Identity رو اضافه میکنم و دستور
Add-Migration InitIdentity -Context IdentityDataBaseContext
رو میزنم ارور میده و کار نمیکنه dotnet7 هست برای من فقط تنها تفاوتش
متن ارور
Unable to create an object of type 'DataBaseContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
PM> Add-Migration InitIdentity -Context IdentityDataBaseContext
Build started...
Build succeeded.
An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: MyShop.Persistence.Contexts.IdentityDataBaseContext Lifetime: Scoped ImplementationType: MyShop.Persistence.Contexts.IdentityDataBaseContext': Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`1[Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityDbContext]' while attempting to activate 'MyShop.Persistence.Contexts.IdentityDataBaseContext'.)
Operation is not valid due to the current state of the object.
- 1402/07/05
به نظر میاد توی DI Container (داخل فایل program.cs) سرویس اشاره شده رو تعریف نکردید
پاسخی برای این باگ ارسال کنید
لطفا کدها را درون قطعه کد ارسال نمایید
برای ارسال پاسخ باید وارد حساب کاربری خود شوید
ورود به حساب کاربری