You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to get Many-To-Many related entities using the Multi-Poco query as such, but it returns duplicated data.
varsql=@"select m.*, q.*from test.queue qleft join test._monitor_queue mq on q.id_queue = mq.id_queueleft join test.monitor m on m.id_monitor = mq.id_monitorwhere m.id_monitor = 1;";varresult=db2.Query<Data.Monitor,Queue,Data.Monitor>((monitor,queue)=>{if(monitor.Queues==null)monitor.Queues=newList<Queue>();monitor.Queues.Add(queue);returnmonitor;},sql).ToArray();
I expected the Func to run with the same monitor entity (as the sql query returns the queues for a single monitor) but it creates a new monitor for each queue.
Result:
Monitor
Queue List
Monitor0
[Queue0]
Monitor1
[Queue1]
Expected Result:
Monitor
Queue List
Monitor0
[Queue0, Queue1]
Is MTM supported by PetaPoco? How can I achieve my expected result?
The text was updated successfully, but these errors were encountered:
I'm trying to get Many-To-Many related entities using the Multi-Poco query as such, but it returns duplicated data.
I expected the Func to run with the same monitor entity (as the sql query returns the queues for a single monitor) but it creates a new monitor for each queue.
Result:
Expected Result:
Is MTM supported by PetaPoco? How can I achieve my expected result?
The text was updated successfully, but these errors were encountered: