Hi,
I'm working on a new Umbraco project with a external database and I love it. But I've run into a problem and question now I have a query with more then 4 joins now.
Before I worked with the following line (and it works great!)
Hi Stevo,
This was posted a while ago but did you ever find a solution? I'm encountering the exact same problem. Need to use a Realator with more than the standard 4 joins (just 1 more, not asking for much ;) ).
Would love to hear what you came up with for a solution.
Hi Dan, thanks for the response. I'm trying to avoid modifying the source if possible just to keep the project easier to update and maintain.
I'm retrieving a list of objects that have have List
Am I missing something?
Sample of my code (generic), just want to be able to add SubObj5.
public IEnumerable
How you would do the above with just a query string? If it was a single model and that model made up of single models I get it, but when you have to use a Relator to iterate and map to a list of sub models, how would that work?
I guess I was being a bit flippant saying modify the source, but originally peta poco was meant to be a simple class that could be modified. So you could take the entire class, move it to your own project, and modify it that way without touching the Umbraco core. Though it's probably not that simple anymore. Guess some kind of extension method wouldn't work?
I can see now what you are trying to do and you are right, there isn't a simple way - I was thinking you just wanted to perform multiple joins that mapped to a single object.
Hi Dan,
I think where my knowledge comes up short is at the "extension method" part and how to implement that. I'd love to be able to extend Umbrabo.Core.Persistence where the PetaPoco code lives so that I can easily keep my Umbraco core up to date and not have to worry about merging source every time.
If you have any suggestions to point me in the right direction there would be greatly appreciated.
Sitting here and having the same problem. Unfortunately i could not find any solutions too.
i found a suggestion here
but could not turn it into usable code. Hope that some experienced community member can help us.
i dont really want to modifying the source code but changing it by copying would be a possibility
i already tried some nested joins to create a result table to merge multiple tables as one result but without any success.
ps: default" joins and automapping with petapoco works without any issues
PetaPoco One To Many with more than 4 POCO's
Hi, I'm working on a new Umbraco project with a external database and I love it. But I've run into a problem and question now I have a query with more then 4 joins now.
Before I worked with the following line (and it works great!)
But now I have to join more tables.
I found the following method
But I can't get it to work! I don't know how to pass the relator callback into the method.
Our help would be greatly appreciated, Thanks Stefan
Hi Stevo, This was posted a while ago but did you ever find a solution? I'm encountering the exact same problem. Need to use a Realator with more than the standard 4 joins (just 1 more, not asking for much ;) ).
Would love to hear what you came up with for a solution.
Cheers, Phill
Go modify the source? :)
https://github.com/umbraco/Umbraco-CMS/blob/10422079b6aa1cc2690bed9dd136cdaaadaef007/src/Umbraco.Core/Persistence/PetaPoco.cs
But can't you just pass in an SQL query as a string, with as many joins as you need, so long as it maps to your return model?
Hi Dan, thanks for the response. I'm trying to avoid modifying the source if possible just to keep the project easier to update and maintain.
I'm retrieving a list of objects that have have List
Am I missing something?
Sample of my code (generic), just want to be able to add SubObj5.
How you would do the above with just a query string? If it was a single model and that model made up of single models I get it, but when you have to use a Relator to iterate and map to a list of sub models, how would that work?
Thanks again.
I guess I was being a bit flippant saying modify the source, but originally peta poco was meant to be a simple class that could be modified. So you could take the entire class, move it to your own project, and modify it that way without touching the Umbraco core. Though it's probably not that simple anymore. Guess some kind of extension method wouldn't work?
I can see now what you are trying to do and you are right, there isn't a simple way - I was thinking you just wanted to perform multiple joins that mapped to a single object.
Hi Dan, I think where my knowledge comes up short is at the "extension method" part and how to implement that. I'd love to be able to extend Umbrabo.Core.Persistence where the PetaPoco code lives so that I can easily keep my Umbraco core up to date and not have to worry about merging source every time.
If you have any suggestions to point me in the right direction there would be greatly appreciated.
Cheers, Phill
Sitting here and having the same problem. Unfortunately i could not find any solutions too. i found a suggestion here but could not turn it into usable code. Hope that some experienced community member can help us. i dont really want to modifying the source code but changing it by copying would be a possibility
i already tried some nested joins to create a result table to merge multiple tables as one result but without any success.
ps: default" joins and automapping with petapoco works without any issues
is working on a reply...