I'm setting up a simple web with Razor controllers to use as an in-house GUI for interfacing with parts of our database. For the most part this goes smoothly, however when it comes to foreign keys, apparently the first column of the referenced table (when sorted alphabetically) becomes the default representation (i.e. what's shown in the drop down box when editing).
As an example, I have a
Campaigns table which has a foreign key to
Companies. There is a
Companies.Name column which I'd like to be used when displaying
Campaigns.CompanyId. However, Razor apparently autopicks the first available, using
Companies.AccessKey (which is pretty unintelligible) to represent the company.
I'm looking for some way to specify which columns are used for representing a row, hopefully without altering the auto generated files.
This is driving me nuts, and although I would assume it's a common issue, for some reason my googling doesn't drum up any answers :(