【发布时间】:2012-04-02 23:57:17
【问题描述】:
使用 .Include - A specified Include path is not valid. The EntityType 'myProject.DAL.Paint' does not declare a navigation property with the name 'Color'. 时出现错误
DAL
public DBSet<Palete> Paletes {get; set; }
public DbSet<Paint> Paints { get; set; }
(注:modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();)
型号
public class Palete
{
public virtual Paint Paint { get; set; }
}
public class Paint
{
public string Color { get; set; }
}
query = query.Include(pal => pal.Paint.Color);
我该如何解决这个错误?
【问题讨论】:
-
请注意,正确的拼写是palette...
标签: c# entity-framework include ef-code-first