需要帮助调试:无法通过RIA服务,实体框架,MySQL获取数据到Silverlight应用程序 [英] Need help debugging: Having trouble getting data to Silverlight App through RIA Services, Entity Framework, MySQL

查看:122
本文介绍了需要帮助调试:无法通过RIA服务,实体框架,MySQL获取数据到Silverlight应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个Silverlight应用程序,用于访问和显示MySQL数据库中的数据。我试图使用Entity Framework来建模MySQL数据和RIA服务,以通过EF将数据提供给Silverlight。

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.

我的Silverlight应用程序正在显示正确的列数据网格,但它不显示数据(替代链接到图像):

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

当我查看DomainService文件(用于RIA服务)时,我看到:

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);
    }

要测试此步骤,我修改了LINQ以删除所在的位置,以便我所有的返回this.Context.saw_or DER; 。当我这样做时,我可以检查MySQL服务器,并确认该查询实际上是发送到MySQL服务器,MySQL服务器是写入NET,并尝试发回数据。从我的测试机器发送的查询是有效的。

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.

从我上面的测试来看,数据正确地发送到MySQL服务器,但在其返回的地方丢失了。我的困难在于试图弄清楚链接中的哪个方面(实体框架到RIA Services到Silverlight客户端)数据丢失,我不知道如何在不同的点进行调试。

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.

例如,我可以通过其他方式测试实体框架来确保EF不是问题?我如何测试RIA服务?我应该在Silverlight客户端上测试吗?

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?

我正在学习C#,而不知道该怎么做来测试。我如何捕获DomainService中的返回值,所以我可以做一些基本的调试。

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.

任何帮助都非常感谢。

推荐答案

更改代码如下:

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.

这篇关于需要帮助调试:无法通过RIA服务,实体框架,MySQL获取数据到Silverlight应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆