I've created default DB context as I do always and tried to add migration. I got an error:
"Unable to create an object of type 'DataContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728"
My DB Context:
public class DataContext : IdentityDbContext<User, ApplicationRole, Guid>
{
public DataContext(DbContextOptions<DataContext> opts) : base(opts) { }
public DbSet<User> Users { get; set; }
public DbSet<Coach> Coaches { get; set; }
public DbSet<Coaching> Coachings { get; set; }
public DbSet<CoachingVideo> CoachingVideos { get; set; }
public DbSet<AppFile> Files { get; set; }
}
My DB Context injection (already in Program.cs)
public static class DataContextExtension
{
public static IServiceCollection AddDataContext(this IServiceCollection services, IConfiguration builder)
{
services.AddDbContext<DataContext>(
o => o.UseSqlServer(builder.GetConnectionString("DefaultConnection")));
return services;
}
}
I tried to install different versions, but nothing...