我不断收到此错误消息:
异常详细信息:MySql.Data.MySqlClient.MySqlException:“字段列表”中的未知列“Extent1.RuleType”
我的映射:
public abstract class AlertRule
{
private DateTime? _updateDateTime = DateTime.Now;
[Key]
public int Id { get; set; }
public int TemplateId { get; set; }
public virtual AlertRuleTemplate Template { get; set; }
public string RuleType
{
get
{
if (Template == null)
return null;
return Template.Name;
}
}
}
public class AlertOutageRule:AlertRule
{
public virtual List<AlertRuleOutage> AlertRuleOutages { get; set; }
}
public class AlertMissingRule:AlertRule{}
public class AlertMetadataRule:AlertRule{}
public DbSet<AlertRule> AlertRules { get; set; }
modelBuilder.Entity<AlertRule>()
.Map<AlertOutageRule>(m => m.Requires("RuleType").HasValue("NewsOutage"))
.Map<AlertMetadataRule>(m => m.Requires("RuleType").HasValue("NewsMetadata"))
.Map<AlertMissingRule>(m => m.Requires("RuleType").HasValue("NewsMissing"));
//.Property(m => m.TemplateId).HasColumnType("int");
modelBuilder.Entity<AlertRule>().ToTable("AlertRule");