melegant99
asked on
Loading Related Entities (ADO.NET Data Services) (Silverlight)?
Hi,
I understand how to use ADO.NET Data Services to let's say load a ProductLine table that has a collection property of Products using a one to many mapping in the design layout.
Now my question is everywhere I look I have found 'lazy' loading examples of populating the Related Entity..say on a Tree Expand or Row Expand using the BeginLoadProperty method. My question is, how can I get these properties to load explicity so I only have to make that single call to the database? I am trying to do it without a LINQ query if possible.
For example, I tried this but it does not work
DataServiceQuery<serviceli ne> slinequery = result.AsyncState as DataServiceQuery<serviceli ne>;
try
{
var returnedServices = slinequery.EndExecute(resu lt);
if (returnedServices != null)
{
foreach (serviceline sline in returnedServices)
{
db.BeginLoadProperty(sline , "services", OnServicesComplete, null); //HERE
ServiceLine.Add(sline);
}....
private void OnServicesComplete(IAsyncR esult result)
{
db.EndLoadProperty(result) ;
}
Thanks.
I understand how to use ADO.NET Data Services to let's say load a ProductLine table that has a collection property of Products using a one to many mapping in the design layout.
Now my question is everywhere I look I have found 'lazy' loading examples of populating the Related Entity..say on a Tree Expand or Row Expand using the BeginLoadProperty method. My question is, how can I get these properties to load explicity so I only have to make that single call to the database? I am trying to do it without a LINQ query if possible.
For example, I tried this but it does not work
DataServiceQuery<serviceli
try
{
var returnedServices = slinequery.EndExecute(resu
if (returnedServices != null)
{
foreach (serviceline sline in returnedServices)
{
db.BeginLoadProperty(sline
ServiceLine.Add(sline);
}....
private void OnServicesComplete(IAsyncR
{
db.EndLoadProperty(result)
}
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.