我正在使用具有以下内容的 petapoco 关系扩展:
Connection.db.FetchOneToMany<Project, UserProject>(x=>x.ID, string.Format(@"
SELECT *
FROM Project
WHERE project.id = userProject.ProjectID
AND userProject.UserID =" + userID +
" ORDER BY project.Name" ));
但出现以下错误。
> The multi-part identifier "userProject.ProjectID" could not be bound. The multi-part identifier "userProject.UserID" could not be bound.
怎么了?我错过了什么吗?
项目类定义
private int id;
public int ID
{
get { return id; }
set { id = value; }
}
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
UserProject 类定义
int id;
int userId;
int projectId;
public int ID
{
get { return id; }
set { id = value; }
}
public int UserID
{
get { return userId; }
set { userId = value; }
}
public int ProjectID
{
get { return projectId; }
set { projectId = value; }
}