Я использую petapoco RelationsExtensions со следующим:
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; }
}