需要帮助调试:通过 RIA 服务、实体框架、MySQL 将数据获取到 Silverlight 应用程序时遇到问题

发布于 2024-08-07 00:14:51 字数 1142 浏览 0 评论 0原文

我正在尝试构建一个 Silverlight 应用程序来访问和呈现 MySQL 数据库中的数据。我正在尝试使用实体框架对 MySQL 数据进行建模,并使用 RIA 服务来通过 EF 将数据提供给 Silverlight。

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

DataGrid with no data :-(

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

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

为了测试此步骤,我修改了 LINQ 以删除 where ,以便我拥有的只是 return this.Context.saw_order; 当我这样做时,我能够检查 MySQL 服务器并验证查询实际上已发送到 MySQL 服务器并且 MySQL 服务器正在“写入 NET”并且从我的测试机器发送的查询是有效的,

数据似乎被正确发送到 MySQL 服务器,但在返回时丢失了。在链(实体框架到 RIA 服务到 Silverlight 客户端)中,数据正在丢失,我不确定如何在不同点进行调试。

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

我正在努力学习 C#,并且不知道要测试什么。我如何“捕获”DomainService 中的返回结果,以便我可以进行一些基本的调试。

非常感谢任何帮助。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

春花秋月 2024-08-14 00:14:51

像这样更改代码:

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

如果您在返回处放置断点,那么您可以尝试在立即窗口中执行查询,看看它是否正确执行。

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.

蓝眼睛不忧郁 2024-08-14 00:14:51

从我上面的测试来看,数据似乎
已正确发送至 MySQL
服务器但在其某处丢失
返回。我现在的困难是尝试
找出链中的位置(实体
RIA 服务框架
Silverlight客户端)数据是
迷路了,我不知道该怎么办
在不同的点进行调试。

我使用以下工具:
Linqpad:这是为了测试我的 linq to sql 语句。它非常简单且易于使用。

Fiddler:Fiddler 会告诉你服务器和客户端之间发生了什么。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文