Second Samuel 7:12 is part of God's covenant promise to David through the prophet Nathan. God declares that after David's death He will raise up one of David's own descendants and establish his kingdom. The immediate historical reference includes Solomon, David's son and successor, but the promise becomes the foundation for a much larger biblical expectation concerning the enduring dynasty of David.
Matthew 1:1 introduces Jesus as "the son of David, the son of Abraham," deliberately placing Him within this covenant line. The genealogy that follows establishes Jesus' descent from David and presents Him as the heir of Israel's royal promises. Thus 2 Samuel 7:12 has both an immediate and an ultimate horizon: Solomon continues David's dynasty historically, while the New Testament identifies Jesus as the climactic Son of David in whom the promise of an enduring Davidic kingdom reaches its messianic fulfillment.