How to get data from relational table using entity framework [Resolved]

Posted by Abhi_Patil under ASP.NET Web API on 10/26/2015 | Points: 10 | Views : 548 | Status : [Member] | Replies : 1
I am fetching data from table using web api and entity framework.
i have .edmx file with relational tables.

there is only 1 record into EmployeeInfo table and this table has foreign key data with other tables.
when i try to fetch data from EmployeeInfo table using following statement, i am getting large data instead of single record.

return db.EmployeeInfo.ToList();


Kindly help me to pull out exact available records from table using entity framework and web api


Posted by: Sheonarayan on: 10/27/2015 [Administrator] HonoraryPlatinum | Points: 50


It is clear from your question that your primary key and foreign key relationship of EmployeeInfo and other tables are not right. Check the relationship diagram in Visual Studio and modify them right and it should work as expected.


Sheo Narayan

Abhi_Patil, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response