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 3272722
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:51:21+00:00 2026-05-17T18:51:21+00:00

So here is the situation. I am using ADP.NET Data Services 1.5 CTP2 with

  • 0

So here is the situation. I am using ADP.NET Data Services 1.5 CTP2 with Silverlight 3. My EF data model is (in short) like this:

CmsProfile
      Id
      Name

CmsEvent
      Id
      Title

CmsProfileEventLink
      Id
      ProfileId
      EventId

So there is a many <-> many relationship between people and events. When I load the events within silverlight, I do it this way:

private void AsyncLoadEventsKickoff()
{
    DataServiceQuery<CmsEvent> theQuery = dashboardService
        .CmsEvents
        .Expand("CmsProfileEventLinks")
        .AddQueryOption("$orderby", "Title");

    theQuery.BeginExecute(
        delegate(IAsyncResult asyncResult)
        {
            Dispatcher.BeginInvoke(
                () =>
                {
                    DataServiceQuery<CmsEvent> query = 
                        asyncResult.AsyncState as DataServiceQuery<CmsEvent>;
                    if (query != null)
                    {
                        //create a tracked DataServiceCollection from the 
                        //result of the asynchronous query.
                        events = DataServiceCollection
                            .CreateTracked<CmsEvent>(dashboardService,
                                query.EndExecute(asyncResult));

                        AsyncLoadTracker();
                    }
                }
            );
        },
        theQuery
    );
}

You will notice that I cannot get Expand() to actually drop the next level and get me the event link details. It will only really tell me if there ARE event link records or not.

I put all the events into a grid (SelectionGrid), and when you click one, I want to load ANOTHER grid (EventsGrid) with the people that are related to this event. I do this by loading the grid with CmsProfileEventLink objects and then drilling down on the DataMemberPath to the profile name. In theory, this allows the grid to add new links for me – when a row is added I give it an Id, and set the CmsEvent to the current event, take the user input for the Profile and blammo – new linked record.

In a perfect world I could just set peopleGrid.ItemsSource = EventsGrid.Selecteditem.CmsPeopleEventLinks and the whole thing would work as expected. However since the expansion doesn’t got that deep, I can’t.

As a workaround I have loaded all the CmsProfileEventLinks the same way into a “links” variable. So when you select a event I do this (ugly, ugly, ugly) to show the profiles…

private void Sync_EventsGrid()
{
    var item = SelectionGrid.SelectedItem as CmsEvent;

    if (item.CmsEventProfileLinks != null)
    {
        DataServiceCollection<CmsEventProfileLink> x = 
            DataServiceCollection
                .CreateTracked<CmsEventProfileLink>(
                     dashboardService, 
                     links.Where(p => p.CmsEvent == item));

        EventsGrid.ItemsSource = x;
    }
}

The problem is… that if a change is made within EventsGrid it does NOT propagate back to links context, even though they both share a DataService context. The net result? if you select a different event and come back, the EventsGrid does NOT show the recently added record. If you refresh the application, forcing it to re-read links from the database? it picks it up.

So I need any of the following…

  1. A way to do the 2 level expansion
    of the CmsEvent record on initial
    load so I can simply pass its links
    property to the second grid
    (preserving the context)

  2. A better way to get a filtered
    view of “links” that does NOT spawn
    an independant context that doesnt
    update

  3. A way to notify the “links”
    object that it should refresh,
    preferably without forcing it to go
    all the way back to the server via a
    async call – since the data clearly
    has been updated in the local
    context.

Any hints?

  • 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-17T18:51:21+00:00Added an answer on May 17, 2026 at 6:51 pm

    You could loop over the expanded property and call LoadProperty on each one to expand its children, like so:

    DataServiceQuery<CmsEvent> query 
                             = asyncResult.AsyncState as DataServiceQuery<CmsEvent>;
    if (query != null)
    {
        //create a tracked DataServiceCollection from the 
        //result of the asynchronous query.
        events = DataServiceCollection.CreateTracked<CmsEvent>(dashboardService,
                                                     query.EndExecute(asyncResult));
        AsyncLoadTracker();
    
        foreach(var link in events.SelectMany(e=> e.CmsProfileEventLink))
        {
             dashboardService.LoadProperty(link, "CmsPeopleEventLinks");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is beyond both making sense and my control. That being said here is
I'm getting an error here that says I haven't defined a method, but it
I would like to remove/delete a migration file. How would I go about doing
I have found this example on StackOverflow: var people = new List<Person> { new
There doesn't seem to be any tried and true set of best practices to
IE is giving me an undefined NAN when i try to view the calender...
I am writing a query to fetch results for all the values in a
Let say I have the following desire, to simplify the IConvertible's to allow me

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.