I've got a LINQ to SQL entity called Book that has a child collection of Authors that represents a relationship between tables of the same name in the db. What I want to do is that when the Book entity is "hydrated" with data from the db, I want to initialize an AuthorsManager object I've created to ease working with the Authors EntitySet. This is happening like such (in the Book object):
partial void OnLoaded()
{
// Load our authors manager
this.AuthorMgr = new AuthorManager(this.Authors);
}
However when the AuthorManager is created, this.Authors is empty!
I specify that the Authors collection is loaded via the appropriate dataLoad options. I've looked at the query via SQL Profiler and I see that the data is indeed coming back as it should be.
I've tried calling .Load() on the Authors EntitySet to no avail. Have I hit a limitation somewhere? I read that OnLoaded() is invoked when the entity has been hydrated from the db... should I be using a different approach? Someone please help :o)