How can I use Eager Loadign in ASP.NET 4.5 / EF6 / MySQL to acheive the following results.
I have the following MySQL tables (sample):
table_1
- t1_id
- t1_name
- t2_id (FK)
table_2
- t2_id
- t2_name
table_3
- t3_id
- t1_id (FK)
- t3_name
I am using ASP.NET 4.5 / Entity Framework 6 / MySQL 5. with the latest .NET connector and develop in Visual Studio 2013.
I want to know how can I use eager loading to get the following results:
Goal
A table 3 item can have several t1 IDs and the T3 row that corresponds to the FK relationship and an array of all the rows that match the T3>T1 FK relationship.
T1 {
t1_id = 1,
t1_name = "something",
t2_id = 3,
T2 {
t2_id = 3,
t2_name = "something 2"
},
Collection {
T3 {
1: {
t3_id = 5,
t3_name = "name"
t1_id = 1
},
2: {
t3_id = 6,
t3_name = "name2",
t1_id = 1
},
}
}
I want to have an object that contains all the data from the related table's relationships based on the foreign key relationship that I created in MySQL WorkBench for each table.