I created an entity framework (.edmx) application in version 4.0 and used it to access all the data from my querying table and any tables that it had foreign key references to. However, when I switch my project to 3.5, I am unable to access the data from tables with foreign key references. Please assist me...
Lazy loading is present and enabled by default in EF4.
Not so in earlier iterations: You may have to add an. Call Include() to automatically load additional material (eager loading) or Load() to load references (manually).
If the reference table was say "Details" you would do ...
var featuredOffers = context.Hosters_FeaturedOffer.Include("Details").ToList();
By the way, if you search for "strongly typed Include," you may find extension methods that allow you to replace the magic text with a lambda expression that has been verified at compilation time.
Using a more recent version of EF for future responses;
var o = db.Order.Include(i => i.User).Include(i => i.OrderItem).FirstOrDefault(x=>x.OrderId == orderId);