AddDefaultTokenProviders мешает создать миграцию
При попытке создать миграцию появляется ошибка -
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:
Microsoft.AspNetCore.Identity.DataProtectorTokenProvider`1[server.Domain.Models.UserModel] Lifetime: Transient ImplementationType:
Microsoft.AspNetCore.Identity.DataProtectorTokenProvider`1[server.Domain.Models.UserModel]': Unable to resolve service for type
'Microsoft.AspNetCore.DataProtection.IDataProtectionProvider' while attempting to activate 'Microsoft.AspNetCore.Identity.DataProtectorTokenProvider`1[server.Domain.Models.UserModel]'.)
Unable to create an object of type 'AppDbContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
Мой Program -
builder.Services.AddDbContext<AppDbContext>(ServiceLifetime.Transient);
builder.Services.AddIdentityCore<UserModel>()
.AddUserManager<UserManager<UserModel>>()
.AddEntityFrameworkStores<AppDbContext>()
.AddDefaultTokenProviders(); // без этого метода работает
DbContext класс -
public class AppDbContext : IdentityDbContext<UserModel>
{
public AppDbContext(
DbContextOptions<AppDbContext> options
)
: base(options)
{ }
}