更新时间:2022-03-24 23:06:14
添加公司中的虚拟财产如
add a virtual property in company like
public class Company
{
//Primary key
public string ID { get; set; }
//Foreign key
public int? LogotypeID { get; set; }
public virtual Logotype Logotype {get;set;}
}
然后
dbContext.Entry<Company>(company).State=EntityState.Modified;
dbContext.Entry<Logotype>(company.Logotype).State=EntityState.Deleted;