Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

WCF Data Service Linq select with where condition

Posted on 2012-03-15
5
828 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

839 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