When declaratory relief is sought, all persons who have or claim any interest that would be affected by the declaration must be made parties, and a declaration may not prejudice the rights of persons not parties to the proceeding. In any proceeding that involves the validity of a municipal ordinance or franchise, the municipality must be made a party, and is entitled to be heard, and if the statute, ordinance, or franchise is alleged to be unconstitutional, the attorney general of the state must be served with a copy of the proceeding and is entitled to be heard. Any trade or professional association authorized to do, and doing, business in the state and whose members are licensed and regulated by state or federal agencies has standing to bring an action for declaratory judgment to determine any question of construction or validity of any statute, ordinance, resolution, rule, or regulation that threatens to injure its members.
N.D.C.C. § 32-23-11