[英]When doing an “update-database” on the package manager console in visual studio i get error : Could not find content root folder
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: 因此,在Visual Studio 2017的程序包管理器控制台中添加新迁移并执行Update-database
命令后,出现以下错误:
Could not find content root folder! 找不到内容根文件夹!
The issue seems to be that somehow the entity framework dbcontext is not connected to any DB. 问题似乎是实体框架dbcontext某种程度上没有连接到任何数据库。
If I run the Get-Dbcontext
command I get the same error. 如果我运行Get-Dbcontext
命令,我将得到相同的错误。 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零角度的问题,我们在文件夹结构中修复了该路径后,此问题已解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.