If the building is attended, such as your house, you can rig a generator outside, running a few essentials like lights, freezer and boiler, off an extension lead.
Boilers are usually fed from an FCU to remove the risk of somebody unplugging them by mistake. Some people point to the manufacturers instructions specifying the minimum gap in the isolator. A plug that is out of the socket meets and exceeds that gap and is perfectly safe.
Less trouble, for short periods, you can get an Uninterruptible Power Supply, as used in computers. You plug one end into the mains, and plug the boiler into the other end. Most of the time the electricity just flows through, but in the event of a power cut, a battery inside keeps the appliance running. I have not needed to buy one for years, old ones used to have a lead acid battery inside, like a miniature car battery, but Lithium batteries are now widely available, much lighter, and keep getting cheaper.
Boilers use very little electricity. I haven't measured mine, but the background power usage in my house, with 2xFridge Freezers, boiler, emergency lighting, radio and phone chargers, is about 250watts.
Ordinary solar inverters are required to switch off in a power cut, for safety reasons, but some have an emergency socket to power your freezer or boiler.
You must not feed a generator or standby power into your house socket or other circuits. It must be separate.