Reputation: 946
I have three tables
Company, CompanyLevel, CompanyType
Company is having one to many relationship with CompanyLevel and CompanyType
I used following query to get Company and CompanyLevel
db.FetchOneToMany<Company, CompanyLevel>(x => x.CompanyId,
Sql.Builder.Append("SELECT CS.*, CL.* FROM Company AS CS").Append(
"LEFT OUTER JOIN [CompanyLevel] AS CL ON CS.CompanyId = CL.CompanyId")
Where db is a database instance of petapoco.
Is it possible to include one more relationship (CompanyType) in this query or how we can include multiple one to many relationship in queries.
I am using Petapoco extension relationship class.
Upvotes: 1
Views: 1468
Reputation: 15987
You can only do 1 onetomany at a time. If you start doing more than one, then you will be returning way to many results than is actually needed. Its probably then better to split up the query into multiple queries.
Upvotes: 1