Need help debugging: Having trouble getting data to Silverlight App through RIA Services, Entity Framework, MySQL

左心房为你撑大大i 提交于 2020-01-06 07:12:25

问题


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) :

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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/1504241/need-help-debugging-having-trouble-getting-data-to-silverlight-app-through-ria

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!