Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 500261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:04:09+00:00 2026-05-13T06:04:09+00:00

I’m using ADO.Net Data Services (Astoria) in Silverlight 3 and I want to delay

  • 0

I’m using ADO.Net Data Services (Astoria) in Silverlight 3 and I want to delay loading properties on an entity until after the initial load. However, when I’m ready to load them I’d like to batch the load requests together.

// this is what I want to avoid
var c = (from c in ctx.Customers.Expand("Address,Phone,Email")
         where c.Id = 12
         select c).Take(1) as DataServiceQuery<Customer>;

I’ve gotten this far:

// I can do this instead
var c = (from c in ctx.Customers // .Expand("Address,Phone,Email")
         where c.Id = 12
         select c).Take(1) as DataServiceQuery<Customer>;
c.BeginExecute(CustomerCallback, objState);

...

// Later, when I want properties, I need to do this
ctx.BeginLoadProperty(c, "Address", AddressCallback, objState);
ctx.BeginLoadProperty(c, "Phone", PhoneCallback, objState);
ctx.BeginLoadProperty(c, "Email", EmailCallback, objState);

However, I can’t figure how how to get a DataServiceRequest object for a load property request to pass to BeginExecuteBatch. Is it possible to issue these requests (and potentially others that aren’t associated with the customer property load) in the same batch by getting a DataServiceQuery?

Something like this:

// c is the customer from the above load
ctx.BeginExecuteBatch(BatchCallback, objState, new []{
    ctx.GetLoadQuery(c, "Address"),
    ctx.GetLoadQuery(c, "Phone"),
    ctx.GetLoadQuery(c, "Email"),
    GetOtherNonPropertyQuery()
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:04:09+00:00Added an answer on May 13, 2026 at 6:04 am

    The LoadProperty method does not use any standard types that are available to you in dataservice. However data service is intelligent enough to figure that

    LoadProperty(person, "Gender")
    

    is the same as

    person.Gender = (from g in ent.Person
                     where g.ID == person.ID
                     select g.Gender).FirstOrDefault();
    

    The Uri generated is the same.

    http://localhost/WebDataService.svc/Person(1)/Gender
    

    So if you want to Call LoadProperty in batch query you can generate the Uri required quite easily. 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 Now you can do this.

    ctx.BeginExecuteBatch(BatchCallback, objState, new []{
        ctx.GetLoadPropertyRequest<Address>(c, "Address"),
        ctx.GetLoadPropertyRequest<Phone>(c, "Phone"),
        ctx.GetLoadPropertyRequest<Email>(c, "Email"),
        GetOtherNonPropertyQuery()
    });
    

    The only thing left is that this will only return to you the object(s) what it wont do is assign the return value(s) to the entity property, that will you have to do it yourself on your BatchCallback.

    Anyhow Peter Hope this helps you on what you want.

    If there is anything you need let me know

    Regards

    Daniel

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to construct a data frame in an Rcpp function, but when I
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.