I'm using EF Database First. In the db we have a lot of fk's from one table to another (same). When generating the model, EF uses the other ends table name as the role name. This is a problem. I have made a small example below, to illustrate the problem.
I would like the generated code to use the fk-name, instead of the table name. The model VS is generating now works like this:
aTrip.Location
aTrip.Location1
aTrip.Location2
when I would like to have
aTrip.coming_from
aTrip.arrives_to
aTrip.next_dest
Now, I can change the role names in VS. The problem with that is that if I re-import, all my changes are lost. Also, there will be a lot of tedious renaming, since our db contains a lot of fk's like this example.
What I would like to, is to change how VS generates the model, and use the fk's col name, which is much more correct. Can that be done?
+----------------+ +-------------+
| Trip | |Location |
+----------------+ | |
| | +-------------+
| | | Name |
| |* 1| |
| coming_from --------------------- |
| | | |
| | | |
| |* 1| |
| arrives_to --------------------- |
| | | |
| | | |
| |* 1| |
| next_dest --------------------- |
| | | |
+----------------+ +-------------+