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();
}
}
}
这是特定于ASP零角度的问题,我们在文件夹结构中修复了该路径后,此问题已解决。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.