I generated my .edmx from SQL Server and I get a confused point.
For example, I have a UserProfile
table and its columns contain Creator
, Modifier
and Deleter
.
But in my auto generated .cs file, only contains the relationship like User1
, User2
and User3
.
I know that I can rename the User1
to Creator
by changing the table's name property in .edmx setting, but I'm afraid what if User1
is not actually map the Creator
but the Modifier
or Deleter
?
Now I use my tables' relationship by knowing that the foreign key obey the order of that in SQL Server and work fine, but I really want to know how it works.
Is there any way to determine the foreign table name in advance when I modify the SQL Server tables? Like I can modify the name when create relationship in SQL Server.
Below is an example of my table's auto-generated model:
public partial class UserProfile
{
public long Creater { get; set; }
public long Modifier { get; set; }
public long Deleter { get; set; }
...
...
public virtual User User { get; set; }
public virtual User User1 { get; set; }
public virtual User User2 { get; set; }
}
I have seen this question that partially match my point, but I need it can be determine by SQL Server table foreign key setting because it will back to default when I regenerate the .edmx.
My English is not good, please don't mind.
Any suggestion is appreciated.