无法创建类型为"电子商务上下文"的对象。对于设计时支持的不同模式


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是通过只定义一个启动项目来修复的。

最新更新