When combined with graphene, hexagonal boron nitride (h-BN) is an ideal substrate and gate dielectric with which to build metal|h-BN|graphene field-effect devices. We use first-principles density functional theory (DFT) calculations for Cu|h-BN|graphene stacks to study how the graphene doping depends on the thickness of the h-BN layer and on a potential difference applied between Cu and graphene. We develop an analytical model that describes the doping very well, allowing us to identify the key parameters that govern the device behavior. A predicted intrinsic doping of graphene is particularly prominent for ultrathin h-BN layers and should be observable in experiment. It is dominated by novel interface terms that we evaluate from DFT calculations for the individual materials and for interfaces between h-BN and Cu or graphene.