I'd like to say something about this subject, I'm a chemist. WD-40 is nothing else than... a light fraction of naphta (check the MSDS), with some Boron-esters just to make its smell more "appealing" (but they don't lubricate anything). So it isn't a good solvent for lubricating things, it's quite volatile and it doesn't protect metals. It's a solvent... that's it
The great breakthrough in the field of chain lubricants was performed introducing teflon oligomers into the oil formulation. These lubricants, that seem milk-like emulsions, leave the chain bright as well as using wd-40 or any other organic solvent, but the teflon oligomers remain on the metal and protect it. These oligomers are very "greasy" and they reduce friction.
The method used by many manufacturer for introducing a lubricant into a chain (for instance) before selling it to people, consists in heating up some grease until it becomes liquid, to put the chain in it, to remove the chain from the grease-bath after some time, to remove the excess of grease after 3-4 hours.