Dharma is not related to the God you worship. Dharma transcends even specific name and form of God. S. Gurumurthy explains in his book, Women: the Liberated vs. the Revered, that the function of Dharma is to harmonize the contradictions,
Dharma, which means 'that (which) sustains the world', was in part religious and in part it transcended religion. It is timeless value system [Sanatana Dharma], which is considered equal, even superior, to God. Dharma bound the King. And even God… in India Dharma prevailed over not only Kings and the Saints, but also Gods! …Dharma being supreme, even Gods and their actions were measured by their adherence to Dharma. …even Gods and their actions could not, even now do not, escape being measured and judged on the principles of Dharma…
Dharma was not only the yardstick to measure the conduct of humans and even Gods, it was also interpreted to harmonize and manage contradiction in human life. Contradictions arise because of the duality inherent in creation. The Indian view and way of life always recognized contradicting duality [Dwaitabhav] in everything connected to the world. The world, in the Hindu view, does not function on the principle of "like either this or that; also there is nothing in between".
Hindu view recognized a vast area of gray between black and white extremes. It is the context for application of a rule more than the text of the rule that is decisive. That is why Rama was great because he, as a dutiful son, obeyed his father unquestioningly; and Prahlada was great because, despite being otherwise obedient as a son he defied his father because of his devotion to God. Likewise, Sita was great because she obeyed her husband Rama unreservedly; and Mira is great because she, despite being a loyal wife, defied her husband because of her devotion to God. These contradictions are harmonized by the rule of Dharma. This is the bandwidth of the intellectual and spiritual tradition of ancient India. (pp. 8-11.)