Case-Based Decision Theory (CBDT) postulates that decision making under uncertainty is based on analogies to past cases. In its original version, it suggests that each of the available acts is ranked according to its own performance in similar decision problems encountered in the past. The purpose of this paper is to extend CBDT to deal with cases in which the evaluation of an act may also depend on past performance of different, but similar acts. To this end we provide a behavioral axiomatic definition of the similarity junction over problem-act pairs (and not over problem pairs alone, as in the original model). We propose a model in which preferences are context-dependent. For each conceivable history of outcomes (to be thought of as the "context" of decision) there preference order over acts. If these context-dependent preference relations satisfy our consistency-across-contexts axioms, there is an essentially unique similarity function that represents these preferences via the (generalized) CBDT functional.