You've got three separate things here:
- Taking energy directly from sunlight.
- Generating an electrical current.
- Generating radiant heat.
They're not necessarily related, and indeed they don't necessarily work well together.
For the first, you need to absorb a lot of sunlight. Photosynthesis isn't very efficient, and to make the most of it you'll need to be living somewhere very sunny. There have been various questions about photosynthetic animals on this site and elsewhere (there's this XKCD what if? that's probably worth a read) but the problems basically boil down to needing more energy than you can extract from the available surface area of the organism, and it being just a lot easier to outsource your photosynthesising to other organisms (like plants) and either eat them directly or let someone else do the hard work of breaking down awkward plant carbohydrates and eat those things instead (like any predator).
For the second, you'll probably want to be generating the electricity from stored energy, not directly from sunlight (because you might want to be able to use your superpowers at night when the sun is elsewhere, or in winter where solar irradiance might be low, or you might want to deliver more power than the sun could possibly deliver) and so you have to store energy and release it later. If you're doing this, you don't actually need to get the energy from solar power at all... in fact, given the whole problem with surface areas and availability of sunlight, you probably just want to eat things and use their calorific value to power your shocking skills. This works well for electric eels and torpedo rays and all the rest, after all.
Electric fish can generate a reasonable amount of power, perhaps as much as a kilowatt for the biggest and baddest examples in the real world, and that's plenty of juice for stunning or killing prey. Here's the thing though: cooking someone takes a lot of power (often many kilowatts) sustained for a considerable amount of time (many minutes, potentially) whereas shocking someone to death can be done with a much more modest power supply running for under a second.
And this is the third problem: generating radiant heat isn't too hard (resistive radiant heaters are efficient and simple, after all) but as a means of killing things it just isn't very good. Unless you've got some kind of organic laser, you're going to have a very short range, and large prey species are going to take a distressing amount of time to actually cook to death especially if they're furred or scaled or wear clothes! So you have to stand (or flap) there whilst some burning fluffy thing runs around frantically until it finally keels over or works out a way to escape or fight back. It just seems like it would be easier to just kill it in a more conventional way... requires far fewer calories, much more straightfoward.
What's to be done?
There's an obvious and classic solution to generating heat from sunlight, and that is to grow sugar-rich plants, pulp them, ferment the pulp and distill the resulting juice to generate ethanol and set that on fire. Perhaps rum or vodka dragons aren't quite what you're after, though.
Electrical powers are perhaps just not very good for aerial dragons, but for partially or wholly aquatic creatures they may be much more useful. Not solar powered, perhaps, but electroception works very badly in air and very well in water, and species with the ability to zap their prey are also electroceptive and so the two tricks go hand in hand.
As for the usefulness of solar organisms: well, there might be various useful tricks, but they're unlikely to involve generating much energy or powering death rays. Humans, for example, have photolyase, a light-powered enzyme that repairs UV-induced damage, and synthesis of vitamin D in the skin from dehydrocholesterol on exposure to UV light. Possibly the solar-boosted hornets make use of similar nutrient-generating or repair processes driven by solar power. Maybe your dragons heal faster or generate fresh scales or feathers quicker in sunlight, for example. Maybe symbiotic photosynthetic bacteria in their skin cells provide fancy colouration as well as chemical benefits.
In any case, solar-powered death-rays seem dubious.