Do it all the time with a smaller Norcold AC/DC unit we have on board. Runs on shore power when connected. If shore power is interrupted for any reason it switches over to DC and upon re-establishment of Shore Power switches back to AC. These are great units to have aboard a small boat or as a supplement to your holding plate. We keep beverages and condiments which require refrigeration in this unit and fire up the holding plate if we are going cruising for several days or longer or need a freezer. The Norcold will even make ice for you--in small quantities but certainly enough to chill a drink. Left on DC with limited opening and closing it draws about 3amps/hour and over a 24 hour period probably in the neighborhood of 15-25amps. This is the second Norcold unit I have had on my current boat. The original lasted for 12 years before the DC side went out. This was my own fault because you cannot run it off of power supplied by an inverter--you have to unplug the AC before turning on the inverter unless it is a pure sine wave unit.
This is a great little unit and one of the few "bullet Proof" pieces of boating equip. that I have found.
Also, if you have holding plate aboard, whether you have an AC side to use while at the dock or DC through your battery charger typically you will be salt water cooled which means there is another hole in the boat allowing water to come in while the boat is unattended-personally, I don''t like this and this is another reason to have the Norcold on board. If your leaving the boat for several days or more and you have your freezer running how do you know that power was not interrupted with foods defrosting and then refreezing, probably spoiled food resulting.