2012-03-15 30 views
0

我有我的SQL作为型ICollection`1的PETAPOCO否物业发现类型的对象:

Connection.db.FetchOneToMany<Project, CustomerProject>(x => x.ID, string.Format(@" 
      SELECT * 
      FROM Project     
      left join customerProject on customerProject.ProjectID = project.id 
       where customerProject.CustomerID = @0 ORDER BY project.Name", customerID)); 

这是给我的错误

型ICollection`1的无属性中找到上类型的对象:项目

CustomerProject定义

ID客户ID专案编号

项目定义

ID名称

有什么不对的查询?

回答

2

您的项目类型没有List<CustomerProject>类型的属性。如果您想要执行OneToMany<>查询,则这是必需的。您也必须使用[Ignore]属性。

相关问题