I'm using the database-first approach while setting my first steps in Entity Framework. In my SQL Server database I have two tables, Location
and Area
.
Both have an Id
column and the Location
table already has an AreadId
property. I would like to use this property for creating a one-to-many association between both tables (many Location
entries for one Area
entry), so I have created the following in my EDMX diagram using the EDMX-designer:
In the automatically generated Location.cs
file, it looks as follows:
public partial class Location
{
...
public int AreaId { get; set; }
...
public virtual Area Area { get; set; }
}
I would like to use the already existing property Location.AreaId
as the foreign key. How can I do that, using EDMX-designer?
Please keep in mind that I can modify the EDMX diagram, but not the automatically generated Location.cs
file.
Thanks in advance