[英]Entity framework invalid column name for static methods
I keep getting an error saying: invalid column 'checked'. 我不断收到错误消息:“检查了无效的列”。 This is correct, because i have no column 'checked' in my database model.
这是正确的,因为我的数据库模型中没有“检查”列。 But i need it for filtering reasoning.
但是我需要它来过滤推理。 Does anyone know how I can keep the checked property, but get rid off the error.
有谁知道我如何保留选中的属性,但摆脱错误。 I work with Entity Framework
我使用实体框架
namespace Entities
{
[MetadataType(typeof(FloorsMetadata))]
public partial class Floors
{
public bool checked { get; set; }
public static List<Floors> GetFloors(context db)
{
return db.Floors.ToList();
}
}
public class FloorsMetadata
{
[JsonIgnore]
public virtual ICollection<Building_Floors>Buildings_Floors { get; set; }
}
}
namespace Entities
{
public partial class Floors
{
public int id { get; set; }
[Required]
[StringLength(100)]
public string name { get; set; }
}
}
class StackOverfloContext : DbContext
{
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Floors>().Ignore(p => p.@checked);
}
}
class Floors
{
public string name { get; set; }
public bool @checked { get; set; }
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.