The LoadProperty method does not use the standard types available to you in the dataservice. However, the data service is intelligent enough to understand that
LoadProperty(person, "Gender")
coincides with
person.Gender = (from g in ent.Person where g.ID == person.ID select g.Gender).FirstOrDefault();
The generated Uri is the same.
http:
So, if you want to call LoadProperty in a batch request, you can easily create a Uri. See below.
public static class DataServiceContextExtensions { public static Uri GetLoadPropertyUri(this DataServiceContext context, object entity, string property) { Uri entityUri = null; if(context.TryGetUri(entity, out entityUri)) { return new Uri(entityUri.AbsoluteUri + "/" + property); } throw new DataServiceClientException("Entity Uri not found."); } public static DataServiceRequest<T> GetLoadPropertyRequest<T>(this DataServiceContext context, object entity, string property) { return new DataServiceRequest<T>(context.GetLoadPropertyUri(entity, property)); } }
So you can do it.
ctx.BeginExecuteBatch(BatchCallback, objState, new []{ ctx.GetLoadPropertyRequest<Address>(c, "Address"), ctx.GetLoadPropertyRequest<Phone>(c, "Phone"), ctx.GetLoadPropertyRequest<Email>(c, "Email"), GetOtherNonPropertyQuery() });
All that remains is that this will only return the object (s) to you, what it will not do is assign the return value (s) to the entity property, which you will need to do yourself on your BatchCallback.
Anyway, Peter Hope helps you with what you want.
If you need anything let me know
Hi
Daniel