When doing an "update-database" on the package manager console in visual studio i get error : Could not find content root folder

c# entity-framework-core package-manager-console

Question

So after adding a new migration in the package manager console in visual studio 2017 and doing the Update-database command, I get the following error:

Could not find content root folder!

The issue seems to be that somehow the entity framework dbcontext is not connected to any DB.

If I run the Get-Dbcontext command I get the same error. Where or how is this linked?

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();
    }
}

}

1
0
9/20/2018 12:15:44 AM

Popular Answer

This is an ASP Zero Angular specific issue, after we fixed that path in our folder structure, this was fixed.

0
10/3/2018 1:12:06 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow