In EF is there a way to specify a relationship between two tables when there is no relationship defined in the database and one of the related columns is a specific string/hard-coded value?
Lets say I have a Document object and it can have various stages of approval and a category. My table might look like
DocumentID, DocumentName, DocumentState, DocumentCategory
With the following Document data:
1, Some Test Document, 0, 0
2, Another Doc, 2, 1
I have a Key/lookup table in the database and the table might look like:
LookupKey, LookupValue, LookupText
With the following data where LookupKey and LookupValue are the primary key (not defined in the db):
DocumentStatus, 0, Draft
DocumentStatus, 1, InReview
DocumentStatus, 2, Final
DocumentCategory, 0, Resume
DocumentCategory, 1, Cover Letter
The tables have two relationships based on:
DocumentStatus = LookupValue AND LookupKey = "DocumentStatus"
And a second relationship
DocumentCategory = LookupValue AND LookupKey = "DocumentCategory"
Can I define this type of relationship within the EDMX?