locked
EF not returning data RRS feed

  • Question

  • Hey guys, I'm brand new to the EF, RIA and Silverlight and I'm having some trouble getting my data from the DB, but there's no error.

    I have a basic Silverlight Navigation App built (just the default Home and About pages) with it's ASP.NET web application to host it.  I created an ADO.NET Entity Data Model in the Web app and selected only a single table (Ratings).  I built the solution, then created a Domain Service class for that one table - RatingDomainService.  I didn't modify anything in either the EF model or the Domain Service class, but when I try to access the Ratings collection I get 0 results.  However, there is lots of data in the table and I'm getting no error.  Being a noob, I really don't know where to start looking, because it's such a non-complicated example...  

    I hope someone can help...

    Here's the code I'm using to try to populate my ListBox and display a count to a TextBlock:

    var context = new Web.RatingDomainContext();
    context.Load(context.GetRatingsQuery());
    lbRatings.ItemsSource = context.Ratings;
    
    txtCount.Text = "Count = " + context.Ratings.Count.ToString();
    


    Wednesday, September 21, 2011 1:29 PM

Answers

  • Sorry I hadn't replied sooner.

    Turns out, I was getting the data just fine, but had a problem with my template on the ListBox.  Nothing was showing up.  And I had put a counter in a textblock that kept reading 0.  It wasn't until later that I found out that I was setting the textbox counter before the list was populated, making it look like I wasn't getting the data.

    • Marked as answer by Alan_chen Thursday, September 29, 2011 7:58 AM
    Wednesday, September 28, 2011 1:24 PM

All replies