PETAPOCO在类型对象上找不到ICollection`1类型的属性:

时间:2012-03-15 12:11:29

标签: petapoco

我正在使用我的sql

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));

给了我错误

  

在类型为:Project

的对象上找不到ICollection`1类型的属性

CustomerProject定义

  

ID CustomerID ProjectID

项目定义

  

ID名称

查询有什么问题?

1 个答案:

答案 0 :(得分:2)

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

相关问题