Hi try the below tool to convert it
https://www.linqpad.net/
http://www.sqltolinq.com/
select top 10 p.Nombre, p.Apellidos, (SELECT COUNT(*) FROM Personas ps WHERE PS.ParentCode LIKE '%' + CONVERT(VARCHAR, p.id) + '-%' ) Total
from personas p
ORDER BY Total desc