Sum values of foreign key table column and populate total in parent key column

Hi,
I have a main table, from which I am populating data in two level tree structure and there is a foreign key present. Using left join on foreign key table from custom query, I am populating some fields along with main table columns. Now, I want to sum values of one field (from foreign key table) and populate it along with main table columns, only for parent row from tree structure.
For this, I have created virtual(dummy) property/attribute in main tables POCO class and wanted to use this attribute to populate sum of fields from child table. How can I proceed ahead with this ?

Thanks in advance

I can’t make any sense from just this description, please provide source code with what you’re trying to do like an executable example on Gistlyn.