A Unifying Theory of Credit and Equity Rationing in Markets with Adverse Selection