0

I'm trying to build a Silverlight App that accesses and presents data from a MySQL database. I'm trying to use Entity Framework to model the MySQL data and RIA Services to make the data via EF available to Silverlight.

My Silverlight App is showing the correct columns in the datagrid, but it does not show the data (alternate link to image) :

DataGrid with no data :-(

When I look at the DomainService file (used for RIA Services), I see this:

    public IQueryable<saw_order> GetSaw_order(int intOrder)
    {
        return this.Context.saw_order
            .Where(o => o.Wo == intOrder);
    }

To test this step, I modified the LINQ to remove the where so that all I had was return this.Context.saw_order;. When I did this, I was able to check the MySQL server and verify that the query was in fact sent to the MySQL server and the MySQL server was "Writing to NET" and trying to send data back. The query sent from my test machine was valid.

From my test above, it seems that data is correctly being sent to the MySQL server but is lost somewhere on its return. My difficulty now is trying to figure out where in the chain (Entity Framework to RIA Services to Silverlight client) the data is getting lost and I'm not sure how to debug this at different points.

For example, what are other ways I might test Entity Framework to make sure EF is not the problem? How might I test RIA services? Should I test on the Silverlight Client?

I'm struggling with learning C# and am not sure what to do to test. How might I "catch" the return in the DomainService so I can do some basic debugging.

Any help is very much appreciated.

Community
  • 1
  • 1
Ben McCormack
  • 32,086
  • 48
  • 148
  • 223
  • It turns out that a lot of the mess comes from the way the MySQL Connector uses date and time stamps. I tried using a table that doesn't have date and time stamps and it works great. – Ben McCormack Oct 01 '09 at 17:03

2 Answers2

3

Change your code like this:

var qry = this.Context.saw_order.Where(o => o.Wo == intOrder);
return qry;

If you put a breakpoint in at the return, then you can try executing the query in the immediate window and see if it is executing correctly.

Colin Blair
  • 270
  • 1
  • 3
  • That helped a good bit when debugging. Now I'm getting some funny errors when hovering over the qry variable. They seem to change each time I hover, but lots of them seem to be datae errors. I'll post some more info in a bit. – Ben McCormack Oct 01 '09 at 15:16
1

From my test above, it seems that data is correctly being sent to the MySQL server but is lost somewhere on its return. My difficulty now is trying to figure out where in the chain (Entity Framework to RIA Services to Silverlight client) the data is getting lost and I'm not sure how to debug this at different points.

I use tools like: Linqpad: This is for testing my linq to sql statements. It is pretty straightforward and easy to use.

Fiddler: Fiddler will tell you what is going on between the server and the client.

johnnywhoop
  • 964
  • 2
  • 7
  • 28
  • Good idea on using Fiddler. I need to do that. Linqpad, however, doesn't support Entities that connect to MySQL. They only support MS SQL Server (and maybe SQL lite or SQL Server Express). – Ben McCormack Oct 01 '09 at 15:25
  • When I installed fiddler I had to set the startup string in my .web file to use 127.0.0.1. instead of localhost. That might save you some time if you run into that. – johnnywhoop Oct 01 '09 at 15:48