I was curious about the lazy/reference loading since I didn't see it
working. I just assumed I was doing something wrong. It'll be great to
help in any way I can.
Hi!
Regards lazy/reference loading we can distinguish two types:
1 - EntitySet lazy/reference loading
2 - EntityRef lazy/reference loading
The first one has been implemented during the summer (or at least a first approximation), until now it seems work properly, you can see it in ReadTest_EntitySet.SimpleMemberAccess01 and 02.
The second one was partially implemented during the summer but not committed, this night I have taken it up again and I have finished the work, it seems work fine (r882).
The following test work properly on mssql :-). It is a pleasure to navigate easily through entities:
public void ReferenceLoading01()
{
var db = CreateDB();
var order = db.Orders.First();
//EntityRef
Assert.IsNotNull(order.Employee);
}
[Test]
public void ReferenceLoading02()
{
var db = CreateDB();
var c = db.Customers.First();
//EntitySet+EntityRef
Assert.IsNotNull(c.Orders.First().Employee);
}
[Test]
public void ReferenceLoading03()
{
var db = CreateDB();
var employeeTerritory = db.EmployeeTerritories.First();
//EntityRef+EntityRef+MemberAccess
Assert.IsNotNull(employeeTerritory.Territory.Region.RegionID);
}
Other comments:
· When an entity is created by the DataContext EntitySet and EntityRefs properties are set or configured (but not retrieved from the database) .
· Maybe there will be problems with entities with multiples PKs. It should be interesting put some 'orders_details inserts' into our database-scripts and make more tests.
Suggestions and corrections are welcome.
Regards.