Solved

WCF Data Service Linq select with where condition

Posted on 2012-03-15
5
810 Views
Last Modified: 2012-09-04
Hi

We have WCF Data Service over an huge database. We have problem with performace on select query across WCF Data Service.

How can we create a select using Linq to join two tables (product and category) and also to put filter condition (where) over both tables (where product.name like 'p' and category.name like 'c') and also to provide faster response on selection.

Or a other solution to select data across WCF Data Service with faster response.

Thanks
Petre
0
Comment
Question by:Syberye
  • 3
5 Comments
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37723828
share the query, its always nice to build queries rather than asking LINQ to help you out with that since it will take its own time processing the query and building it for you.

Share the query so that we can fix the performance issue if possible....

For the time bieng here is example of join using LINQ to SQL:-
http://code.msdn.microsoft.com/Linq-to-SQL-Join-Example-02180bee
0
 

Author Comment

by:Syberye
ID: 37724070
Sorry

Now we use like this:

var eData = dataServiceContext.platform_encoding_profiles.Expand("encoding_profiles").Where(finalWhere);

dataServiceContext - is WCF Data Service
finalWhere - is some lamba expresion use "p => p.platform_id == platformID"

the problem is that we have a wery slow answer from a table with 1000 rows

I read tha if I use Linq espresion like, look down, will be more faster.
var a = from p in platforms
      join pe in platform_encoding_profiles on p.id equals pe.platform_id
                where p.name.Contains("a") && pe.active.Equals(1) select new {p.name, pe.active }
I test this Linq select using LinqPad and I get this error: "The method 'Join' is not supported "

What can I do, or how can I do to use this kind of select ower WCF Data Service

Best regards
Petre
0
 
LVL 18

Expert Comment

by:Anil Golamari
ID: 37725263
Can you try this query and see if it works.

var a  = (from p in platforms
            join pe in platform_encoding_profiles
            on p.id equals pe.platform_id
            into pg
           from pe in pg.DefaultifEmpty()
           select new {
                    Name = p.name,
                    State = pe.active
                    }).Where (p.name.Contains("a") && pe.active.Equals(1));
0
 

Accepted Solution

by:
Syberye earned 0 total points
ID: 38349672
We eliminate the WCF service
0
 

Author Closing Comment

by:Syberye
ID: 38362787
not a true solution
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Loop not working 29 47
insert image with its metadata into SQL server Database 3 87
asp.net mvc input file 2 32
Export import database 4 41
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now