0

因此,在 Visual Studio 2017 的包管理器控制台中添加新迁移并执行Update-database命令后,我收到以下错误:

找不到内容根文件夹!

问题似乎是实体框架 dbcontext 没有连接到任何数据库。

如果我运行Get-Dbcontext命令,我会得到同样的错误。这是在哪里或如何联系起来的?

public class ......DbContext : AbpZeroDbContext<Tenant, Role, User, ..........DbContext>, IAbpPersistedGrantDbContext
{
    /* Define an IDbSet for each entity of the application */

    public virtual DbSet<BinaryObject> BinaryObjects { get; set; }

    public virtual DbSet<Friendship> Friendships { get; set; }

    public virtual DbSet<ChatMessage> ChatMessages { get; set; }

    public virtual DbSet<SubscribableEdition> SubscribableEditions { get; set; }

    public virtual DbSet<SubscriptionPayment> SubscriptionPayments { get; set; }

    public virtual DbSet<Invoice> Invoices { get; set; }

    public virtual DbSet<PersistedGrantEntity> PersistedGrants { get; set; }

    public virtual DbSet<Person> Persons { get; set; }
    public virtual DbSet<Position> Positions { get; set; }

    public FutureAthletesDbContext(DbContextOptions<FutureAthletesDbContext> options)
        : base(options)
    {

    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);

        modelBuilder.Entity<BinaryObject>(b =>
        {
            b.HasIndex(e => new { e.TenantId });
        });

        modelBuilder.Entity<ChatMessage>(b =>
        {
            b.HasIndex(e => new { e.TenantId, e.UserId, e.ReadState });
            b.HasIndex(e => new { e.TenantId, e.TargetUserId, e.ReadState });
            b.HasIndex(e => new { e.TargetTenantId, e.TargetUserId, e.ReadState });
            b.HasIndex(e => new { e.TargetTenantId, e.UserId, e.ReadState });
        });

        modelBuilder.Entity<Friendship>(b =>
        {
            b.HasIndex(e => new { e.TenantId, e.UserId });
            b.HasIndex(e => new { e.TenantId, e.FriendUserId });
            b.HasIndex(e => new { e.FriendTenantId, e.UserId });
            b.HasIndex(e => new { e.FriendTenantId, e.FriendUserId });
        });

        modelBuilder.Entity<Tenant>(b =>
        {
            b.HasIndex(e => new { e.SubscriptionEndDateUtc });
            b.HasIndex(e => new { e.CreationTime });
        });

        modelBuilder.Entity<SubscriptionPayment>(b =>
        {
            b.HasIndex(e => new { e.Status, e.CreationTime });
            b.HasIndex(e => new { e.PaymentId, e.Gateway });
        });

        modelBuilder.ConfigurePersistedGrantEntity();
    }
}

}

4

1 回答 1

0

这是一个 ASP Zero Angular 特定问题,在我们在文件夹结构中修复了该路径后,此问题已得到修复。

于 2018-10-03T13:12:06.943 回答