How to implement a one-to-many relationship with an “Is Current” requirement
问题 Designing a database, there's a relationship between two tables, Job and Document . One Job can have multiple Documents , but one (and only one) of these Documents needs to be flagged as IsCurrent . This is not always the most recent Document associated with that Job . Structurally, I can see two ways of doing this. The first is to add a DocumentId column to Job , and a JobId column to Document . This will work, but creates a circular reference: when imported into Entity Framework you end up