无法创建类型为“ EcommerceContext”的对象针对设计时支持的不同模式

问题描述

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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...