我最近从我的表中删除了一列ConversationId
。当我开始调试我的服务,并试图挽救我得到一个错误:实体框架核心仍旧挑选旧列
Invalid column name 'ConversationId'.
代码:
public class AstootContext : DbContext
{
public AstootContext(DbContextOptions<AstootContext> options)
: base(options)
{ }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
}
public DbSet<ServiceRequest> ServiceRequests { get; set; }
}
我的实体是这样的:
public class ServiceRequest
{
public int Id { get; set; }
public int SenderUserId { get; set; }
public int PriceTypeId { get; set; }
public decimal Price { get; set; }
public bool IsAccepted { get; set; }
public DateTime Created { get; set; }
public int MessageId { get; set; }
}
全部以引用ConversationId
已从代码中删除,我已重建,但仍然出现此错误,我不明白为什么。
这是我的SQL Server表,你可以看到有没有ConversationId
:
有一个秘密的缓存,我需要删除或东西我要运行更新呢?
我想你可以尝试运行'再次migrations'更新我没有使用迁移目前修改的列 –
@HaHoang ,我的数据库没有反映我的外键结构 –
听起来就像你有一个名为'Conversation'的实体,具有像'public ICollection ServiceRequests {get;组; '',不是吗? –