Question

I am having my sql as

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

which is giving me the error

No Property of type ICollection`1 found on object of type: Project

CustomerProject definition

ID CustomerID ProjectID

Project definition

ID Name

What is wrong with the query?

Was it helpful?

Solution

You don't have a property of type List<CustomerProject> on your Project type. This is required if you want to do a OneToMany<> query. You will have to use the [Ignore] attribute on it too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top