问题描述
public class EcommerceContext : IdentityDbContext<IdentityUser>
{
public EcommerceContext(DbContextOptions options) : base(options)
{
}
// use real database
services.AddDbContext<EcommerceContext>(c =>
c.UseSqlServer(Configuration.GetConnectionString("EcommerceConnection"),x => x.MigrationsAssembly("Ecommerce.Web")));
PM>添加迁移InitializeDb 构建开始... 构建成功。 无法创建类型为“ EcommerceContext”的对象。有关设计时支持的不同模式,请参见https://go.microsoft.com/fwlink/?linkid=851728
解决方法
就我而言,该解决方案有多个启动项目。 Anit 是通过只定义一个启动项目来修复的。