Welcome to FT!
You always earn miles/EQMs based on the policy of the operating carrier. Code shares offer no advantages for mileage earning. What you earn on an LH flight depends on the fare class you're booking. If you're in paid first or business class you'll get a 50% EQM bonus, most other economy fares have no bonus EQM's and some deeply discounted fares earn no miles at all for intra European flights.
http://www.united.com/page/article/0,,1189,00.html