本文介绍了Lightswitch很慢,ADO.NET实体框架/域服务/ WCF RIA服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用外部SQL Server 2008在VS2012中开发Lighswitch应用程序。我使用WCF RIA服务来使用以下技术来获取我的数据:



在本文中,创建RIA服务以专门集成数据以在图表中显示,但您可以执行所需的任何操作。它不必汇总数据。我将RIA服务与附加的数据源(SQL数据库)一起广泛使用,为列表,报告以及组合框查找数据提供数据。


I'm developing an Lighswitch application in VS2012 with an external SQL Server 2008. I'm using a WCF RIA Service to fetch my data, using these techniques: http://www.c-sharpcorner.com/UploadFile/raj1979/how-to-use-wcf-ria-service-in-lightswitch-2012/.

My main table contains some columns with static data and about 5 columns with foreign keys. The static data columns loads instant but all the foreign properties takes 3-5 secs to load on a screen with ~100 rows. This is not acceptable..

The problem for me is that I don't know where the bottleneck might be. Any ideas where I could start looking? The only thing I could think of so far is that my ADO.NET model uses Lazy Loading, and it does.

All the foreign key properties only has two columns with a PK and some text, so they're not data heavy.

Any help appreciated, thanks!

解决方案

I don't know if this is the exact answer to your speed problem, but that article you quoted suggests that you add a new ADO.NET Data Model to the class library containing the RIA Service.

There's absolutely no reason to generate a second data model, as LightSwitch already generates one when you attach the external data source (your SQL Server database). You may as well re-use it. An EF data model takes time to construct, so I suppose that using two EF data models could explain the slowness you're experiencing, but it could also be something else entirely.

Have a look at this article (the original RIA Service/LightSwitch article, & still the best), which among several other techniques, Eric will show you how to re-use the data model that LightSwitch creates for your data source.

How Do I: Display a Chart Built On Aggregated Data

In this article, the RIA service is created to specifically aggregate data to display in a chart, but you can do whatever you need to do in it. It doesn't have to aggregate data. I use RIA services with an attached data source (a SQL database) extensively, to provide data for lists, reports, as well as lookup data for combo boxes.

这篇关于Lightswitch很慢,ADO.NET实体框架/域服务/ WCF RIA服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 03:42